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
acb06ea9
Commit
acb06ea9
authored
Apr 07, 2015
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed thread id bug in async mode by passing thread id in log_msg struct
parent
69d71c52
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
3 deletions
+12
-3
async_log_helper.h
include/spdlog/details/async_log_helper.h
+2
-0
line_logger.h
include/spdlog/details/line_logger.h
+2
-1
log_msg.h
include/spdlog/details/log_msg.h
+7
-1
pattern_formatter_impl.h
include/spdlog/details/pattern_formatter_impl.h
+1
-1
No files found.
include/spdlog/details/async_log_helper.h
View file @
acb06ea9
...
@@ -60,6 +60,7 @@ class async_log_helper
...
@@ -60,6 +60,7 @@ class async_log_helper
level
::
level_enum
level
;
level
::
level_enum
level
;
log_clock
::
time_point
time
;
log_clock
::
time_point
time
;
std
::
string
txt
;
std
::
string
txt
;
std
::
thread
::
id
thread_id
;
async_msg
()
=
default
;
async_msg
()
=
default
;
~
async_msg
()
=
default
;
~
async_msg
()
=
default
;
...
@@ -99,6 +100,7 @@ async_msg(async_msg&& other) SPDLOG_NOEXCEPT:
...
@@ -99,6 +100,7 @@ async_msg(async_msg&& other) SPDLOG_NOEXCEPT:
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
.
raw
<<
txt
;
msg
.
raw
<<
txt
;
}
}
};
};
...
...
include/spdlog/details/line_logger.h
View file @
acb06ea9
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
#include <type_traits>
#include <type_traits>
#include "../common.h"
#include "../common.h"
#include "../logger.h"
#include "../logger.h"
#include <pthread.h>
// Line logger class - aggregates operator<< calls to fast ostream
// Line logger class - aggregates operator<< calls to fast ostream
// and logs upon destruction
// and logs upon destruction
...
@@ -65,6 +65,7 @@ public:
...
@@ -65,6 +65,7 @@ public:
{
{
_log_msg
.
logger_name
=
_callback_logger
->
name
();
_log_msg
.
logger_name
=
_callback_logger
->
name
();
_log_msg
.
time
=
os
::
now
();
_log_msg
.
time
=
os
::
now
();
_log_msg
.
thread_id
=
std
::
this_thread
::
get_id
();
_callback_logger
->
_log_msg
(
_log_msg
);
_callback_logger
->
_log_msg
(
_log_msg
);
}
}
}
}
...
...
include/spdlog/details/log_msg.h
View file @
acb06ea9
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#pragma once
#pragma once
#include <thread>
#include "../common.h"
#include "../common.h"
#include "./format.h"
#include "./format.h"
...
@@ -38,6 +39,7 @@ struct log_msg
...
@@ -38,6 +39,7 @@ struct log_msg
logger_name
(),
logger_name
(),
level
(
l
),
level
(
l
),
time
(),
time
(),
thread_id
(),
raw
(),
raw
(),
formatted
()
{}
formatted
()
{}
...
@@ -45,7 +47,8 @@ struct log_msg
...
@@ -45,7 +47,8 @@ struct log_msg
log_msg
(
const
log_msg
&
other
)
:
log_msg
(
const
log_msg
&
other
)
:
logger_name
(
other
.
logger_name
),
logger_name
(
other
.
logger_name
),
level
(
other
.
level
),
level
(
other
.
level
),
time
(
other
.
time
)
time
(
other
.
time
),
thread_id
(
other
.
thread_id
)
{
{
if
(
other
.
raw
.
size
())
if
(
other
.
raw
.
size
())
raw
<<
fmt
::
BasicStringRef
<
char
>
(
other
.
raw
.
data
(),
other
.
raw
.
size
());
raw
<<
fmt
::
BasicStringRef
<
char
>
(
other
.
raw
.
data
(),
other
.
raw
.
size
());
...
@@ -57,6 +60,7 @@ struct log_msg
...
@@ -57,6 +60,7 @@ struct log_msg
logger_name
(
std
::
move
(
other
.
logger_name
)),
logger_name
(
std
::
move
(
other
.
logger_name
)),
level
(
other
.
level
),
level
(
other
.
level
),
time
(
std
::
move
(
other
.
time
)),
time
(
std
::
move
(
other
.
time
)),
thread_id
(
other
.
thread_id
),
raw
(
std
::
move
(
other
.
raw
)),
raw
(
std
::
move
(
other
.
raw
)),
formatted
(
std
::
move
(
other
.
formatted
))
formatted
(
std
::
move
(
other
.
formatted
))
{
{
...
@@ -71,6 +75,7 @@ struct log_msg
...
@@ -71,6 +75,7 @@ struct log_msg
logger_name
=
std
::
move
(
other
.
logger_name
);
logger_name
=
std
::
move
(
other
.
logger_name
);
level
=
other
.
level
;
level
=
other
.
level
;
time
=
std
::
move
(
other
.
time
);
time
=
std
::
move
(
other
.
time
);
thread_id
=
other
.
thread_id
;
raw
=
std
::
move
(
other
.
raw
);
raw
=
std
::
move
(
other
.
raw
);
formatted
=
std
::
move
(
other
.
formatted
);
formatted
=
std
::
move
(
other
.
formatted
);
other
.
clear
();
other
.
clear
();
...
@@ -87,6 +92,7 @@ struct log_msg
...
@@ -87,6 +92,7 @@ struct log_msg
std
::
string
logger_name
;
std
::
string
logger_name
;
level
::
level_enum
level
;
level
::
level_enum
level
;
log_clock
::
time_point
time
;
log_clock
::
time_point
time
;
std
::
thread
::
id
thread_id
;
fmt
::
MemoryWriter
raw
;
fmt
::
MemoryWriter
raw
;
fmt
::
MemoryWriter
formatted
;
fmt
::
MemoryWriter
formatted
;
};
};
...
...
include/spdlog/details/pattern_formatter_impl.h
View file @
acb06ea9
...
@@ -354,7 +354,7 @@ class t_formatter :public flag_formatter
...
@@ -354,7 +354,7 @@ class t_formatter :public flag_formatter
{
{
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
)
override
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
)
override
{
{
msg
.
formatted
<<
std
::
hash
<
std
::
thread
::
id
>
()(
std
::
this_thread
::
get_id
()
);
msg
.
formatted
<<
std
::
hash
<
std
::
thread
::
id
>
()(
msg
.
thread_id
);
}
}
};
};
...
...
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