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
36134491
Commit
36134491
authored
May 21, 2017
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored message counter a little
parent
7da3e47d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
13 deletions
+6
-13
include/spdlog/details/async_logger_impl.h
include/spdlog/details/async_logger_impl.h
+3
-0
include/spdlog/details/logger_impl.h
include/spdlog/details/logger_impl.h
+3
-13
No files found.
include/spdlog/details/async_logger_impl.h
View file @
36134491
...
...
@@ -87,6 +87,9 @@ inline void spdlog::async_logger::_sink_it(details::log_msg& msg)
{
try
{
#if defined(SPDLOG_ENABLE_MESSAGE_COUNTER)
msg
.
msg_id
=
_msg_counter
.
fetch_add
(
1
,
std
::
memory_order_relaxed
);
#endif
_async_log_helper
->
log
(
msg
);
if
(
_should_flush_on
(
msg
))
_async_log_helper
->
flush
(
false
);
// do async flush
...
...
include/spdlog/details/logger_impl.h
View file @
36134491
...
...
@@ -68,11 +68,6 @@ inline void spdlog::logger::log(level::level_enum lvl, const char* fmt, const Ar
{
details
::
log_msg
log_msg
(
&
_name
,
lvl
);
log_msg
.
raw
.
write
(
fmt
,
args
...);
#if defined(SPDLOG_ENABLE_MESSAGE_COUNTER)
log_msg
.
msg_id
=
_msg_counter
.
fetch_add
(
1
,
std
::
memory_order_relaxed
);
#endif
_sink_it
(
log_msg
);
}
catch
(
const
std
::
exception
&
ex
)
...
...
@@ -93,11 +88,6 @@ inline void spdlog::logger::log(level::level_enum lvl, const char* msg)
{
details
::
log_msg
log_msg
(
&
_name
,
lvl
);
log_msg
.
raw
<<
msg
;
#if defined(SPDLOG_ENABLE_MESSAGE_COUNTER)
log_msg
.
msg_id
=
_msg_counter
.
fetch_add
(
1
,
std
::
memory_order_relaxed
);
#endif
_sink_it
(
log_msg
);
}
catch
(
const
std
::
exception
&
ex
)
...
...
@@ -119,9 +109,6 @@ inline void spdlog::logger::log(level::level_enum lvl, const T& msg)
{
details
::
log_msg
log_msg
(
&
_name
,
lvl
);
log_msg
.
raw
<<
msg
;
#if defined(SPDLOG_ENABLE_MESSAGE_COUNTER)
log_msg
.
msg_id
=
_msg_counter
.
fetch_add
(
1
,
std
::
memory_order_relaxed
);
#endif
_sink_it
(
log_msg
);
}
catch
(
const
std
::
exception
&
ex
)
...
...
@@ -313,6 +300,9 @@ inline bool spdlog::logger::should_log(spdlog::level::level_enum msg_level) cons
//
inline
void
spdlog
::
logger
::
_sink_it
(
details
::
log_msg
&
msg
)
{
#if defined(SPDLOG_ENABLE_MESSAGE_COUNTER)
msg
.
msg_id
=
_msg_counter
.
fetch_add
(
1
,
std
::
memory_order_relaxed
);
#endif
_formatter
->
format
(
msg
);
for
(
auto
&
sink
:
_sinks
)
{
...
...
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