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
9f841330
Commit
9f841330
authored
Jan 03, 2018
by
Sam Lunt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add global flush_on function
parent
a2890f27
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
1 deletion
+22
-1
include/spdlog/details/registry.h
include/spdlog/details/registry.h
+11
-0
include/spdlog/details/spdlog_impl.h
include/spdlog/details/spdlog_impl.h
+5
-0
include/spdlog/spdlog.h
include/spdlog/spdlog.h
+6
-1
No files found.
include/spdlog/details/registry.h
View file @
9f841330
...
...
@@ -64,6 +64,7 @@ public:
new_logger
->
set_error_handler
(
_err_handler
);
new_logger
->
set_level
(
_level
);
new_logger
->
flush_on
(
_flush_level
);
//Add to registry
...
...
@@ -85,6 +86,7 @@ public:
new_logger
->
set_error_handler
(
_err_handler
);
new_logger
->
set_level
(
_level
);
new_logger
->
flush_on
(
_flush_level
);
//Add to registry
_loggers
[
logger_name
]
=
new_logger
;
...
...
@@ -153,6 +155,14 @@ public:
_level
=
log_level
;
}
void
flush_on
(
level
::
level_enum
log_level
)
{
std
::
lock_guard
<
Mutex
>
lock
(
_mutex
);
for
(
auto
&
l
:
_loggers
)
l
.
second
->
flush_on
(
log_level
);
_flush_level
=
log_level
;
}
void
set_error_handler
(
log_err_handler
handler
)
{
for
(
auto
&
l
:
_loggers
)
...
...
@@ -197,6 +207,7 @@ private:
std
::
unordered_map
<
std
::
string
,
std
::
shared_ptr
<
logger
>>
_loggers
;
formatter_ptr
_formatter
;
level
::
level_enum
_level
=
level
::
info
;
level
::
level_enum
_flush_level
=
level
::
off
;
log_err_handler
_err_handler
;
bool
_async_mode
=
false
;
size_t
_async_q_size
=
0
;
...
...
include/spdlog/details/spdlog_impl.h
View file @
9f841330
...
...
@@ -236,6 +236,11 @@ inline void spdlog::set_level(level::level_enum log_level)
return
details
::
registry
::
instance
().
set_level
(
log_level
);
}
inline
void
spdlog
::
flush_on
(
level
::
level_enum
log_level
)
{
return
details
::
registry
::
instance
().
flush_on
(
log_level
);
}
inline
void
spdlog
::
set_error_handler
(
log_err_handler
handler
)
{
return
details
::
registry
::
instance
().
set_error_handler
(
handler
);
...
...
include/spdlog/spdlog.h
View file @
9f841330
...
...
@@ -36,10 +36,15 @@ void set_pattern(const std::string& format_string);
void
set_formatter
(
formatter_ptr
f
);
//
// Set global logging level
for
// Set global logging level
//
void
set_level
(
level
::
level_enum
log_level
);
//
// Set global flush level
//
void
flush_on
(
level
::
level_enum
log_level
);
//
// Set global error handler
//
...
...
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