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
8d8aacf5
Commit
8d8aacf5
authored
Aug 23, 2019
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Protect from double call to enable_backtrace()
parent
e085ba7f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
+12
-4
include/spdlog/logger-inl.h
include/spdlog/logger-inl.h
+11
-4
include/spdlog/logger.h
include/spdlog/logger.h
+1
-0
No files found.
include/spdlog/logger-inl.h
View file @
8d8aacf5
...
...
@@ -120,14 +120,21 @@ SPDLOG_INLINE void logger::set_pattern(std::string pattern, pattern_time_type ti
set_formatter
(
std
::
move
(
new_formatter
));
}
// create new backtrace sink and hand it all sinks
SPDLOG_INLINE
void
logger
::
enable_backtrace
(
level
::
level_enum
trigger_level
,
size_t
n_messages
)
{
auto
backtrace_sink
=
std
::
make_shared
<
spdlog
::
sinks
::
backtrace_sink_mt
>
(
trigger_level
,
n_messages
);
backtrace_sink
->
set_sinks
(
std
::
move
(
sinks
()));
sinks
().
push_back
(
std
::
move
(
backtrace_sink
));
this
->
set_level
(
spdlog
::
level
::
trace
);
if
(
!
backtrace_enabled_
)
{
backtrace_enabled_
=
true
;
auto
backtrace_sink
=
std
::
make_shared
<
spdlog
::
sinks
::
backtrace_sink_mt
>
(
trigger_level
,
n_messages
);
backtrace_sink
->
set_sinks
(
std
::
move
(
sinks
()));
sinks
().
push_back
(
std
::
move
(
backtrace_sink
));
this
->
set_level
(
spdlog
::
level
::
trace
);
}
}
// flush functions
SPDLOG_INLINE
void
logger
::
flush
()
{
...
...
include/spdlog/logger.h
View file @
8d8aacf5
...
...
@@ -347,6 +347,7 @@ protected:
spdlog
::
level_t
level_
{
level
::
info
};
spdlog
::
level_t
flush_level_
{
level
::
off
};
err_handler
custom_err_handler_
{
nullptr
};
bool
backtrace_enabled_
{
false
};
virtual
void
sink_it_
(
const
details
::
log_msg
&
msg
);
virtual
void
flush_
();
...
...
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