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
56678a5f
Commit
56678a5f
authored
Oct 01, 2016
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added set_force_flush(bool) to simple file sink for performance benchmarks
parent
12800ac4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
include/spdlog/sinks/file_sinks.h
include/spdlog/sinks/file_sinks.h
+9
-2
No files found.
include/spdlog/sinks/file_sinks.h
View file @
56678a5f
...
@@ -29,7 +29,7 @@ template<class Mutex>
...
@@ -29,7 +29,7 @@ template<class Mutex>
class
simple_file_sink
:
public
base_sink
<
Mutex
>
class
simple_file_sink
:
public
base_sink
<
Mutex
>
{
{
public:
public:
explicit
simple_file_sink
(
const
filename_t
&
filename
,
bool
truncate
=
false
)
explicit
simple_file_sink
(
const
filename_t
&
filename
,
bool
truncate
=
false
)
:
_force_flush
(
false
)
{
{
_file_helper
.
open
(
filename
,
truncate
);
_file_helper
.
open
(
filename
,
truncate
);
}
}
...
@@ -37,14 +37,21 @@ public:
...
@@ -37,14 +37,21 @@ public:
{
{
_file_helper
.
flush
();
_file_helper
.
flush
();
}
}
void
set_force_flush
(
bool
force_flush
)
{
_force_flush
=
force_flush
;
}
protected:
protected:
void
_sink_it
(
const
details
::
log_msg
&
msg
)
override
void
_sink_it
(
const
details
::
log_msg
&
msg
)
override
{
{
_file_helper
.
write
(
msg
);
_file_helper
.
write
(
msg
);
if
(
_force_flush
)
_file_helper
.
flush
();
}
}
private:
private:
details
::
file_helper
_file_helper
;
details
::
file_helper
_file_helper
;
bool
_force_flush
;
};
};
typedef
simple_file_sink
<
std
::
mutex
>
simple_file_sink_mt
;
typedef
simple_file_sink
<
std
::
mutex
>
simple_file_sink_mt
;
...
...
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