Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
spdlog
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
spdlog
Commits
7635455c
Commit
7635455c
authored
Jan 07, 2015
by
gabi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed "auto_flush" to "force_flush" to better represent the meaning
parent
06ef01f8
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
22 deletions
+22
-22
include/spdlog/details/file_helper.h
include/spdlog/details/file_helper.h
+4
-4
include/spdlog/details/spdlog_impl.h
include/spdlog/details/spdlog_impl.h
+8
-8
include/spdlog/sinks/file_sinks.h
include/spdlog/sinks/file_sinks.h
+6
-6
include/spdlog/spdlog.h
include/spdlog/spdlog.h
+4
-4
No files found.
include/spdlog/details/file_helper.h
View file @
7635455c
...
...
@@ -48,9 +48,9 @@ public:
const
int
open_tries
=
5
;
const
int
open_interval
=
10
;
explicit
file_helper
(
bool
auto
_flush
)
:
explicit
file_helper
(
bool
force
_flush
)
:
_fd
(
nullptr
),
_
auto_flush
(
auto
_flush
)
_
force_flush
(
force
_flush
)
{}
file_helper
(
const
file_helper
&
)
=
delete
;
...
...
@@ -104,7 +104,7 @@ public:
if
(
std
::
fwrite
(
data
,
1
,
size
,
_fd
)
!=
size
)
throw
spdlog_ex
(
"Failed writing to file "
+
_filename
);
if
(
_
auto
_flush
)
if
(
_
force
_flush
)
std
::
fflush
(
_fd
);
}
...
...
@@ -131,7 +131,7 @@ public:
private:
FILE
*
_fd
;
std
::
string
_filename
;
bool
_
auto
_flush
;
bool
_
force
_flush
;
};
...
...
include/spdlog/details/spdlog_impl.h
View file @
7635455c
...
...
@@ -43,24 +43,24 @@ inline void spdlog::drop(const std::string &name)
}
// Create multi/single threaded rotating file logger
inline
std
::
shared_ptr
<
spdlog
::
logger
>
spdlog
::
rotating_logger_mt
(
const
std
::
string
&
logger_name
,
const
std
::
string
&
filename
,
size_t
max_file_size
,
size_t
max_files
,
bool
auto
_flush
)
inline
std
::
shared_ptr
<
spdlog
::
logger
>
spdlog
::
rotating_logger_mt
(
const
std
::
string
&
logger_name
,
const
std
::
string
&
filename
,
size_t
max_file_size
,
size_t
max_files
,
bool
force
_flush
)
{
return
create
<
spdlog
::
sinks
::
rotating_file_sink_mt
>
(
logger_name
,
filename
,
"txt"
,
max_file_size
,
max_files
,
auto
_flush
);
return
create
<
spdlog
::
sinks
::
rotating_file_sink_mt
>
(
logger_name
,
filename
,
"txt"
,
max_file_size
,
max_files
,
force
_flush
);
}
inline
std
::
shared_ptr
<
spdlog
::
logger
>
spdlog
::
rotating_logger_st
(
const
std
::
string
&
logger_name
,
const
std
::
string
&
filename
,
size_t
max_file_size
,
size_t
max_files
,
bool
auto
_flush
)
inline
std
::
shared_ptr
<
spdlog
::
logger
>
spdlog
::
rotating_logger_st
(
const
std
::
string
&
logger_name
,
const
std
::
string
&
filename
,
size_t
max_file_size
,
size_t
max_files
,
bool
force
_flush
)
{
return
create
<
spdlog
::
sinks
::
rotating_file_sink_st
>
(
logger_name
,
filename
,
"txt"
,
max_file_size
,
max_files
,
auto
_flush
);
return
create
<
spdlog
::
sinks
::
rotating_file_sink_st
>
(
logger_name
,
filename
,
"txt"
,
max_file_size
,
max_files
,
force
_flush
);
}
// Create file logger which creates new file at midnight):
inline
std
::
shared_ptr
<
spdlog
::
logger
>
spdlog
::
daily_logger_mt
(
const
std
::
string
&
logger_name
,
const
std
::
string
&
filename
,
bool
auto
_flush
)
inline
std
::
shared_ptr
<
spdlog
::
logger
>
spdlog
::
daily_logger_mt
(
const
std
::
string
&
logger_name
,
const
std
::
string
&
filename
,
bool
force
_flush
)
{
return
create
<
spdlog
::
sinks
::
daily_file_sink_mt
>
(
logger_name
,
filename
,
"txt"
,
auto
_flush
);
return
create
<
spdlog
::
sinks
::
daily_file_sink_mt
>
(
logger_name
,
filename
,
"txt"
,
force
_flush
);
}
inline
std
::
shared_ptr
<
spdlog
::
logger
>
spdlog
::
daily_logger_st
(
const
std
::
string
&
logger_name
,
const
std
::
string
&
filename
,
bool
auto
_flush
)
inline
std
::
shared_ptr
<
spdlog
::
logger
>
spdlog
::
daily_logger_st
(
const
std
::
string
&
logger_name
,
const
std
::
string
&
filename
,
bool
force
_flush
)
{
return
create
<
spdlog
::
sinks
::
daily_file_sink_st
>
(
logger_name
,
filename
,
"txt"
,
auto
_flush
);
return
create
<
spdlog
::
sinks
::
daily_file_sink_st
>
(
logger_name
,
filename
,
"txt"
,
force
_flush
);
}
...
...
include/spdlog/sinks/file_sinks.h
View file @
7635455c
...
...
@@ -44,8 +44,8 @@ class simple_file_sink : public base_sink<Mutex>
{
public:
explicit
simple_file_sink
(
const
std
::
string
&
filename
,
bool
auto
_flush
=
false
)
:
_file_helper
(
auto
_flush
)
bool
force
_flush
=
false
)
:
_file_helper
(
force
_flush
)
{
_file_helper
.
open
(
filename
);
}
...
...
@@ -71,13 +71,13 @@ class rotating_file_sink : public base_sink<Mutex>
public:
rotating_file_sink
(
const
std
::
string
&
base_filename
,
const
std
::
string
&
extension
,
std
::
size_t
max_size
,
std
::
size_t
max_files
,
bool
auto
_flush
=
false
)
:
bool
force
_flush
=
false
)
:
_base_filename
(
base_filename
),
_extension
(
extension
),
_max_size
(
max_size
),
_max_files
(
max_files
),
_current_size
(
0
),
_file_helper
(
auto
_flush
)
_file_helper
(
force
_flush
)
{
_file_helper
.
open
(
calc_filename
(
_base_filename
,
0
,
_extension
));
}
...
...
@@ -157,11 +157,11 @@ class daily_file_sink:public base_sink<Mutex>
public:
explicit
daily_file_sink
(
const
std
::
string
&
base_filename
,
const
std
::
string
&
extension
,
bool
auto
_flush
=
false
)
:
bool
force
_flush
=
false
)
:
_base_filename
(
base_filename
),
_extension
(
extension
),
_midnight_tp
(
_calc_midnight_tp
()
),
_file_helper
(
auto
_flush
)
_file_helper
(
force
_flush
)
{
_file_helper
.
open
(
calc_filename
(
_base_filename
,
_extension
));
}
...
...
include/spdlog/spdlog.h
View file @
7635455c
...
...
@@ -70,14 +70,14 @@ void set_sync_mode();
//
// Create multi/single threaded rotating file logger
//
std
::
shared_ptr
<
logger
>
rotating_logger_mt
(
const
std
::
string
&
logger_name
,
const
std
::
string
&
filename
,
size_t
max_file_size
,
size_t
max_files
,
bool
auto
_flush
=
false
);
std
::
shared_ptr
<
logger
>
rotating_logger_st
(
const
std
::
string
&
logger_name
,
const
std
::
string
&
filename
,
size_t
max_file_size
,
size_t
max_files
,
bool
auto
_flush
=
false
);
std
::
shared_ptr
<
logger
>
rotating_logger_mt
(
const
std
::
string
&
logger_name
,
const
std
::
string
&
filename
,
size_t
max_file_size
,
size_t
max_files
,
bool
force
_flush
=
false
);
std
::
shared_ptr
<
logger
>
rotating_logger_st
(
const
std
::
string
&
logger_name
,
const
std
::
string
&
filename
,
size_t
max_file_size
,
size_t
max_files
,
bool
force
_flush
=
false
);
//
// Create file logger which creates new file at midnight):
//
std
::
shared_ptr
<
logger
>
daily_logger_mt
(
const
std
::
string
&
logger_name
,
const
std
::
string
&
filename
,
bool
auto
_flush
=
false
);
std
::
shared_ptr
<
logger
>
daily_logger_st
(
const
std
::
string
&
logger_name
,
const
std
::
string
&
filename
,
bool
auto
_flush
=
false
);
std
::
shared_ptr
<
logger
>
daily_logger_mt
(
const
std
::
string
&
logger_name
,
const
std
::
string
&
filename
,
bool
force
_flush
=
false
);
std
::
shared_ptr
<
logger
>
daily_logger_st
(
const
std
::
string
&
logger_name
,
const
std
::
string
&
filename
,
bool
force
_flush
=
false
);
//
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment