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
48597a94
Commit
48597a94
authored
Nov 11, 2018
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated example
parent
0e77c339
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
example/example.cpp
example/example.cpp
+11
-4
No files found.
example/example.cpp
View file @
48597a94
...
@@ -22,7 +22,8 @@ void err_handler_example();
...
@@ -22,7 +22,8 @@ void err_handler_example();
void
syslog_example
();
void
syslog_example
();
void
clone_example
();
void
clone_example
();
#define SPDLOG_TRACE_ON
// activate compile time macros to be debug or above
#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_DEBUG
#include "spdlog/spdlog.h"
#include "spdlog/spdlog.h"
...
@@ -160,12 +161,18 @@ void binary_example()
...
@@ -160,12 +161,18 @@ void binary_example()
}
}
// Compile time log levels.
// Compile time log levels.
//
Must define SPDLOG_DEBUG_ON or SPDLOG_TRACE_ON before including spdlog.h to turn them on.
//
define SPDLOG_ACTIVE_LEVEL to required level (e.g. SPDLOG_LEVEL_TRACE)
void
trace_example
()
void
trace_example
()
{
{
// trace from default logger
SPDLOG_TRACE
(
"Enabled only #ifdef SPDLOG_TRACE_ON..{} ,{}"
,
1
,
3.23
);
// debug from default logger
SPDLOG_DEBUG
(
"Enabled only #ifdef SPDLOG_DEBUG_ON.. {} ,{}"
,
1
,
3.23
);
// trace from logger object
auto
logger
=
spdlog
::
get
(
"file_logger"
);
auto
logger
=
spdlog
::
get
(
"file_logger"
);
SPDLOG_TRACE
(
logger
,
"Enabled only #ifdef SPDLOG_TRACE_ON..{} ,{}"
,
1
,
3.23
);
SPDLOG_LOGGER_TRACE
(
logger
,
"another trace message"
);
SPDLOG_DEBUG
(
logger
,
"Enabled only #ifdef SPDLOG_DEBUG_ON.. {} ,{}"
,
1
,
3.23
);
}
}
// A logger with multiple sinks (stdout and file) - each with a different format and log level.
// A logger with multiple sinks (stdout and file) - each with a different format and log level.
...
...
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