Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
spdlog
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
spdlog
Commits
42258a10
Commit
42258a10
authored
May 12, 2017
by
Alexander Zilberkant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move discarded message handling to a dedicated function
fix - formatter new discarded message
parent
0aeaf9e2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
11 deletions
+18
-11
async_log_helper.h
include/spdlog/details/async_log_helper.h
+18
-11
No files found.
include/spdlog/details/async_log_helper.h
View file @
42258a10
...
...
@@ -189,6 +189,9 @@ private:
// counter for messages discarded due to queue overflow
std
::
atomic
<
unsigned
int
>
_discarded_msg_count
;
// handle discarded messages
void
handle_discarded_msg
(
const
std
::
string
&
logger_name
);
};
}
}
...
...
@@ -319,16 +322,7 @@ inline bool spdlog::details::async_log_helper::process_next_msg(log_clock::time_
default
:
#if defined(SPDLOG_ASYNC_COUNT_DISCARDED_MSG)
unsigned
int
num_of_discarded_messages
=
_discarded_msg_count
.
exchange
(
0
);
if
(
num_of_discarded_messages
)
{
log_msg
discarded_warning_msg
(
&
incoming_async_msg
.
logger_name
,
level
::
warn
);
discarded_warning_msg
.
raw
<<
"Dropped "
<<
num_of_discarded_messages
<<
" messages"
;
for
(
auto
&
s
:
_sinks
)
{
s
->
log
(
discarded_warning_msg
);
}
}
handle_discarded_msg
(
incoming_async_msg
.
logger_name
);
#endif
log_msg
incoming_log_msg
;
...
...
@@ -415,5 +409,18 @@ inline void spdlog::details::async_log_helper::set_error_handler(spdlog::log_err
_err_handler
=
err_handler
;
}
inline
void
spdlog
::
details
::
async_log_helper
::
handle_discarded_msg
(
const
std
::
string
&
logger_name
)
{
unsigned
int
num_of_discarded_messages
=
_discarded_msg_count
.
exchange
(
0
);
if
(
num_of_discarded_messages
)
{
log_msg
discarded_warning_msg
(
&
logger_name
,
level
::
warn
);
discarded_warning_msg
.
raw
<<
"Discarded "
<<
num_of_discarded_messages
<<
" messages - logger queue overflow"
;
_formatter
->
format
(
discarded_warning_msg
);
for
(
auto
&
s
:
_sinks
)
{
s
->
log
(
discarded_warning_msg
);
}
}
}
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