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