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
7a85acc3
Commit
7a85acc3
authored
May 20, 2018
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed logger_name field from async_msg
parent
7cbf832c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
17 deletions
+26
-17
async_log_helper.h
include/spdlog/details/async_log_helper.h
+25
-16
async_logger_impl.h
include/spdlog/details/async_logger_impl.h
+1
-1
No files found.
include/spdlog/details/async_log_helper.h
View file @
7a85acc3
...
...
@@ -45,8 +45,7 @@ class async_log_helper
};
struct
async_msg
{
std
::
string
logger_name
;
{
level
::
level_enum
level
;
log_clock
::
time_point
time
;
size_t
thread_id
;
...
...
@@ -81,15 +80,12 @@ class async_log_helper
,
msg_type
(
async_msg_type
::
log
)
,
msg_id
(
m
.
msg_id
)
{
#ifndef SPDLOG_NO_NAME
logger_name
=
*
m
.
logger_name
;
#endif
}
// copy into log_msg
void
fill_log_msg
(
log_msg
&
msg
)
void
fill_log_msg
(
log_msg
&
msg
,
std
::
string
*
logger_name
)
{
msg
.
logger_name
=
&
logger_name
;
msg
.
logger_name
=
logger_name
;
msg
.
level
=
level
;
msg
.
time
=
time
;
msg
.
thread_id
=
thread_id
;
...
...
@@ -105,10 +101,15 @@ public:
using
clock
=
std
::
chrono
::
steady_clock
;
async_log_helper
(
formatter_ptr
formatter
,
std
::
vector
<
sink_ptr
>
sinks
,
size_t
queue_size
,
const
log_err_handler
err_handler
,
const
async_overflow_policy
overflow_policy
=
async_overflow_policy
::
block_retry
,
std
::
function
<
void
()
>
worker_warmup_cb
=
nullptr
,
const
std
::
chrono
::
milliseconds
&
flush_interval_ms
=
std
::
chrono
::
milliseconds
::
zero
(),
std
::
function
<
void
()
>
worker_teardown_cb
=
nullptr
);
async_log_helper
(
std
::
string
logger_name
,
formatter_ptr
formatter
,
std
::
vector
<
sink_ptr
>
sinks
,
size_t
queue_size
,
const
log_err_handler
err_handler
,
const
async_overflow_policy
overflow_policy
=
async_overflow_policy
::
block_retry
,
std
::
function
<
void
()
>
worker_warmup_cb
=
nullptr
,
const
std
::
chrono
::
milliseconds
&
flush_interval_ms
=
std
::
chrono
::
milliseconds
::
zero
(),
std
::
function
<
void
()
>
worker_teardown_cb
=
nullptr
);
void
log
(
const
details
::
log_msg
&
msg
);
...
...
@@ -125,6 +126,7 @@ public:
void
set_error_handler
(
spdlog
::
log_err_handler
err_handler
);
private
:
std
::
string
_logger_name
;
formatter_ptr
_formatter
;
std
::
vector
<
std
::
shared_ptr
<
sinks
::
sink
>>
_sinks
;
...
...
@@ -174,10 +176,17 @@ private:
///////////////////////////////////////////////////////////////////////////////
// async_sink class implementation
///////////////////////////////////////////////////////////////////////////////
inline
spdlog
::
details
::
async_log_helper
::
async_log_helper
(
formatter_ptr
formatter
,
std
::
vector
<
sink_ptr
>
sinks
,
size_t
queue_size
,
log_err_handler
err_handler
,
const
async_overflow_policy
overflow_policy
,
std
::
function
<
void
()
>
worker_warmup_cb
,
const
std
::
chrono
::
milliseconds
&
flush_interval_ms
,
std
::
function
<
void
()
>
worker_teardown_cb
)
:
_formatter
(
std
::
move
(
formatter
))
inline
spdlog
::
details
::
async_log_helper
::
async_log_helper
(
std
::
string
logger_name
,
formatter_ptr
formatter
,
std
::
vector
<
sink_ptr
>
sinks
,
size_t
queue_size
,
log_err_handler
err_handler
,
const
async_overflow_policy
overflow_policy
,
std
::
function
<
void
()
>
worker_warmup_cb
,
const
std
::
chrono
::
milliseconds
&
flush_interval_ms
,
std
::
function
<
void
()
>
worker_teardown_cb
)
:
_logger_name
(
std
::
move
(
logger_name
))
,
_formatter
(
std
::
move
(
formatter
))
,
_sinks
(
std
::
move
(
sinks
))
,
_q
(
queue_size
)
,
_err_handler
(
std
::
move
(
err_handler
))
...
...
@@ -281,7 +290,7 @@ inline bool spdlog::details::async_log_helper::process_next_msg()
default
:
log_msg
incoming_log_msg
;
incoming_async_msg
.
fill_log_msg
(
incoming_log_msg
);
incoming_async_msg
.
fill_log_msg
(
incoming_log_msg
,
&
_logger_name
);
_formatter
->
format
(
incoming_log_msg
);
for
(
auto
&
s
:
_sinks
)
{
...
...
include/spdlog/details/async_logger_impl.h
View file @
7a85acc3
...
...
@@ -22,7 +22,7 @@ inline spdlog::async_logger::async_logger(const std::string &logger_name, const
const
std
::
chrono
::
milliseconds
&
flush_interval_ms
,
const
std
::
function
<
void
()
>
&
worker_teardown_cb
)
:
logger
(
logger_name
,
begin
,
end
)
,
_async_log_helper
(
new
details
::
async_log_helper
(
_formatter
,
_sinks
,
queue_size
,
_err_handler
,
overflow_policy
,
worker_warmup_cb
,
flush_interval_ms
,
worker_teardown_cb
))
logger_name
,
_formatter
,
_sinks
,
queue_size
,
_err_handler
,
overflow_policy
,
worker_warmup_cb
,
flush_interval_ms
,
worker_teardown_cb
))
{
}
...
...
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