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
6b966478
Commit
6b966478
authored
May 02, 2016
by
Kevin M. Godby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Automatically flush log if message level is above certain severity.
parent
0143d9a9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
0 deletions
+15
-0
include/spdlog/details/line_logger_impl.h
include/spdlog/details/line_logger_impl.h
+5
-0
include/spdlog/details/logger_impl.h
include/spdlog/details/logger_impl.h
+6
-0
include/spdlog/logger.h
include/spdlog/logger.h
+4
-0
No files found.
include/spdlog/details/line_logger_impl.h
View file @
6b966478
...
...
@@ -46,6 +46,11 @@ inline spdlog::details::line_logger::~line_logger()
#endif
_callback_logger
->
_log_msg
(
_log_msg
);
}
if
(
_log_msg
.
level
>=
_callback_logger
->
_flush_level
)
{
_callback_logger
->
flush
();
}
}
//
...
...
include/spdlog/details/logger_impl.h
View file @
6b966478
...
...
@@ -21,6 +21,7 @@ inline spdlog::logger::logger(const std::string& logger_name, const It& begin, c
// no support under vs2013 for member initialization for std::atomic
_level
=
level
::
info
;
_flush_level
=
level
::
off
;
}
// ctor with sinks as init list
...
...
@@ -266,6 +267,11 @@ inline void spdlog::logger::set_level(spdlog::level::level_enum log_level)
_level
.
store
(
log_level
);
}
inline
void
spdlog
::
logger
::
flush_on
(
level
::
level_enum
log_level
)
{
_flush_level
.
store
(
log_level
);
}
inline
spdlog
::
level
::
level_enum
spdlog
::
logger
::
level
()
const
{
return
static_cast
<
spdlog
::
level
::
level_enum
>
(
_level
.
load
(
std
::
memory_order_relaxed
));
...
...
include/spdlog/logger.h
View file @
6b966478
...
...
@@ -41,6 +41,9 @@ public:
const
std
::
string
&
name
()
const
;
bool
should_log
(
level
::
level_enum
)
const
;
// automatically call flush() after a message of level log_level or higher is emitted
void
flush_on
(
level
::
level_enum
log_level
);
// logger.info(cppformat_string, arg1, arg2, arg3, ...) call style
template
<
typename
...
Args
>
details
::
line_logger
trace
(
const
char
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
debug
(
const
char
*
fmt
,
const
Args
&
...
args
);
...
...
@@ -104,6 +107,7 @@ protected:
std
::
vector
<
sink_ptr
>
_sinks
;
formatter_ptr
_formatter
;
spdlog
::
level_t
_level
;
spdlog
::
level_t
_flush_level
;
};
}
...
...
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