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
f20b12cf
Commit
f20b12cf
authored
Mar 06, 2020
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update example
parent
c8bd5350
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
example/example.cpp
example/example.cpp
+7
-6
No files found.
example/example.cpp
View file @
f20b12cf
...
...
@@ -23,6 +23,7 @@ void syslog_example();
int
main
(
int
,
char
*
[])
{
spdlog
::
info
(
"Welcome to spdlog version {}.{}.{} !"
,
SPDLOG_VER_MAJOR
,
SPDLOG_VER_MINOR
,
SPDLOG_VER_PATCH
);
spdlog
::
warn
(
"Easy padding in numbers like {:08d}"
,
12
);
...
...
@@ -31,6 +32,12 @@ int main(int, char *[])
spdlog
::
info
(
"Positional args are {1} {0}.."
,
"too"
,
"supported"
);
spdlog
::
info
(
"{:>8} aligned, {:<8} aligned"
,
"right"
,
"left"
);
// Runtime log levels
spdlog
::
set_level
(
spdlog
::
level
::
info
);
// Set global log level to info
spdlog
::
debug
(
"This message should not be displayed!"
);
spdlog
::
set_level
(
spdlog
::
level
::
trace
);
// Set specific logger's log level
spdlog
::
debug
(
"This message should be displayed.."
);
// Log levels can also loaded from argv/env using "SPDLOG_LEVEL"
// For example: set the global level to info and mylogger to to trace:
// SPDLOG_LEVEL=info,mylogger=trace && ./example
...
...
@@ -40,12 +47,6 @@ int main(int, char *[])
// #include "spdlog/cfg/argv.h" // for loading levels from argv
// spdlog::cfg::load_argv_levels(args, argv);
// Runtime log levels
spdlog
::
set_level
(
spdlog
::
level
::
info
);
// Set global log level to info
spdlog
::
debug
(
"This message should not be displayed!"
);
spdlog
::
set_level
(
spdlog
::
level
::
trace
);
// Set specific logger's log level
spdlog
::
debug
(
"This message should be displayed.."
);
// Customize msg format for all loggers
spdlog
::
set_pattern
(
"[%H:%M:%S %z] [%^%L%$] [thread %t] %v"
);
spdlog
::
info
(
"This an info message with custom format"
);
...
...
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