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
1b04c222
Commit
1b04c222
authored
Oct 30, 2018
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed issue #888
parent
5d048488
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
10 deletions
+17
-10
include/spdlog/details/log_msg.h
include/spdlog/details/log_msg.h
+2
-3
include/spdlog/details/thread_pool.h
include/spdlog/details/thread_pool.h
+7
-2
tests/file_helper.cpp
tests/file_helper.cpp
+0
-1
tests/test_pattern_formatter.cpp
tests/test_pattern_formatter.cpp
+8
-4
No files found.
include/spdlog/details/log_msg.h
View file @
1b04c222
...
...
@@ -15,7 +15,6 @@ namespace spdlog {
namespace
details
{
struct
log_msg
{
log_msg
()
=
default
;
log_msg
(
const
std
::
string
*
loggers_name
,
level
::
level_enum
lvl
,
string_view_t
view
)
:
logger_name
(
loggers_name
)
...
...
@@ -38,9 +37,9 @@ struct log_msg
level
::
level_enum
level
{
level
::
off
};
log_clock
::
time_point
time
;
size_t
thread_id
{
0
};
size_t
msg_id
;
size_t
msg_id
{
0
}
;
//
info about
wrapping the formatted text with color (updated by pattern_formatter).
// wrapping the formatted text with color (updated by pattern_formatter).
mutable
size_t
color_range_start
{
0
};
mutable
size_t
color_range_end
{
0
};
...
...
include/spdlog/details/thread_pool.h
View file @
1b04c222
...
...
@@ -82,12 +82,17 @@ struct async_msg
}
async_msg
(
async_logger_ptr
&&
worker
,
async_msg_type
the_type
)
:
async_msg
(
std
::
move
(
worker
),
the_type
,
details
::
log_msg
())
:
msg_type
(
the_type
)
,
level
(
level
::
off
)
,
time
()
,
thread_id
(
0
)
,
msg_id
(
0
)
,
worker_ptr
(
std
::
move
(
worker
))
{
}
explicit
async_msg
(
async_msg_type
the_type
)
:
async_msg
(
nullptr
,
the_type
,
details
::
log_msg
()
)
:
async_msg
(
nullptr
,
the_type
)
{
}
...
...
tests/file_helper.cpp
View file @
1b04c222
...
...
@@ -10,7 +10,6 @@ static const std::string target_filename = "logs/file_helper_test.txt";
static
void
write_with_helper
(
file_helper
&
helper
,
size_t
howmany
)
{
log_msg
msg
;
fmt
::
memory_buffer
formatted
;
fmt
::
format_to
(
formatted
,
"{}"
,
std
::
string
(
howmany
,
'1'
));
helper
.
write
(
formatted
);
...
...
tests/test_pattern_formatter.cpp
View file @
1b04c222
...
...
@@ -75,7 +75,8 @@ TEST_CASE("color range test1", "[pattern_formatter]")
TEST_CASE
(
"color range test2"
,
"[pattern_formatter]"
)
{
auto
formatter
=
std
::
make_shared
<
spdlog
::
pattern_formatter
>
(
"%^%$"
,
spdlog
::
pattern_time_type
::
local
,
"
\n
"
);
spdlog
::
details
::
log_msg
msg
;
std
::
string
logger_name
=
"test"
;
spdlog
::
details
::
log_msg
msg
(
&
logger_name
,
spdlog
::
level
::
info
,
""
);
fmt
::
memory_buffer
formatted
;
formatter
->
format
(
msg
,
formatted
);
REQUIRE
(
msg
.
color_range_start
==
0
);
...
...
@@ -86,7 +87,8 @@ TEST_CASE("color range test2", "[pattern_formatter]")
TEST_CASE
(
"color range test3"
,
"[pattern_formatter]"
)
{
auto
formatter
=
std
::
make_shared
<
spdlog
::
pattern_formatter
>
(
"%^***%$"
);
spdlog
::
details
::
log_msg
msg
;
std
::
string
logger_name
=
"test"
;
spdlog
::
details
::
log_msg
msg
(
&
logger_name
,
spdlog
::
level
::
info
,
"ignored"
);
fmt
::
memory_buffer
formatted
;
formatter
->
format
(
msg
,
formatted
);
REQUIRE
(
msg
.
color_range_start
==
0
);
...
...
@@ -109,7 +111,8 @@ TEST_CASE("color range test4", "[pattern_formatter]")
TEST_CASE
(
"color range test5"
,
"[pattern_formatter]"
)
{
auto
formatter
=
std
::
make_shared
<
spdlog
::
pattern_formatter
>
(
"**%^"
);
spdlog
::
details
::
log_msg
msg
;
std
::
string
logger_name
=
"test"
;
spdlog
::
details
::
log_msg
msg
(
&
logger_name
,
spdlog
::
level
::
info
,
"ignored"
);
fmt
::
memory_buffer
formatted
;
formatter
->
format
(
msg
,
formatted
);
REQUIRE
(
msg
.
color_range_start
==
2
);
...
...
@@ -119,7 +122,8 @@ TEST_CASE("color range test5", "[pattern_formatter]")
TEST_CASE
(
"color range test6"
,
"[pattern_formatter]"
)
{
auto
formatter
=
std
::
make_shared
<
spdlog
::
pattern_formatter
>
(
"**%$"
);
spdlog
::
details
::
log_msg
msg
;
std
::
string
logger_name
=
"test"
;
spdlog
::
details
::
log_msg
msg
(
&
logger_name
,
spdlog
::
level
::
info
,
"ignored"
);
fmt
::
memory_buffer
formatted
;
formatter
->
format
(
msg
,
formatted
);
REQUIRE
(
msg
.
color_range_start
==
0
);
...
...
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