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
1fd166d4
Commit
1fd166d4
authored
Jul 08, 2018
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated example
parent
5bfeb672
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
example/example.cpp
example/example.cpp
+6
-6
No files found.
example/example.cpp
View file @
1fd166d4
...
...
@@ -132,21 +132,21 @@ void async_example()
}
// create logger with 2 targets with different log levels and formats
// the console will show only warnings or errors, while the file will log all
void
multi_sink_example
()
{
auto
console_sink
=
std
::
make_shared
<
spdlog
::
sinks
::
stdout_color_sink_mt
>
();
auto
console_sink
=
std
::
make_shared
<
spdlog
::
sinks
::
stdout_color_sink_mt
>
();
console_sink
->
set_level
(
spdlog
::
level
::
warn
);
console_sink
->
set_pattern
(
"[multi_sink_example] [%^%l%$] %v"
);
auto
file_sink
=
std
::
make_shared
<
spdlog
::
sinks
::
basic_file_sink_mt
>
(
"logs/multisink.txt"
,
true
);
file_sink
->
set_level
(
spdlog
::
level
::
info
);
auto
file_sink
=
std
::
make_shared
<
spdlog
::
sinks
::
basic_file_sink_mt
>
(
"logs/multisink.txt"
,
true
);
file_sink
->
set_level
(
spdlog
::
level
::
trace
);
spdlog
::
logger
logger
(
"multi_sink"
,
{
console_sink
,
file_sink
});
logger
.
set_level
(
spdlog
::
level
::
debug
);
logger
.
warn
(
"this should appear in both console and file"
);
logger
.
info
(
"this message should not appear in the console, only in the file"
);
}
// user defined types logging by implementing operator<<
#include "spdlog/fmt/ostr.h" // must be included
...
...
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