Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
spdlog
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
spdlog
Commits
70d0e873
Commit
70d0e873
authored
Jun 21, 2016
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
example update
parent
db01c6b6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
README.md
README.md
+5
-5
example.cpp
example/example.cpp
+5
-5
No files found.
README.md
View file @
70d0e873
...
...
@@ -92,15 +92,15 @@ int main(int, char* [])
//
// Create a basic multithreaded file logger (use "file_logger_st" for the single threaded version)
//
auto
simple_logger
=
spd
::
file_logger_mt
(
"basic_logger"
,
"logs/simple
.txt"
);
simple
_logger
->
info
(
"Some log message"
);
auto
my_logger
=
spd
::
file_logger_mt
(
"basic_logger"
,
"logs/basic
.txt"
);
my
_logger
->
info
(
"Some log message"
);
//
// Create a file rotating logger with 5mb size max and 3 rotated files
//
auto
file_logger
=
spd
::
rotating_logger_mt
(
"file_logger
"
,
"logs/mylogfile"
,
1048576
*
5
,
3
);
auto
rotating_logger
=
spd
::
rotating_logger_mt
(
"some_logger_name
"
,
"logs/mylogfile"
,
1048576
*
5
,
3
);
for
(
int
i
=
0
;
i
<
10
;
++
i
)
file
_logger
->
info
(
"{} * {} equals {:>10}"
,
i
,
i
,
i
*
i
);
rotating
_logger
->
info
(
"{} * {} equals {:>10}"
,
i
,
i
,
i
*
i
);
//
// Create a daily logger - a new file is created every day on 2:30am
...
...
@@ -111,7 +111,7 @@ int main(int, char* [])
// Customize msg format for all messages
//
spd
::
set_pattern
(
"*** [%H:%M:%S %z] [thread %t] %v ***"
);
file
_logger
->
info
(
"This is another message with custom format"
);
rotating
_logger
->
info
(
"This is another message with custom format"
);
spd
::
get
(
"console"
)
->
info
(
"loggers can be retrieved from a global registry using the spdlog::get(logger_name) function"
);
...
...
example/example.cpp
View file @
70d0e873
...
...
@@ -44,21 +44,21 @@ int main(int, char*[])
console
->
debug
(
"This message shold be displayed.."
);
// Create basic file logger (not rotated)
auto
simple_logger
=
spd
::
basic_logger_mt
(
"basic_logger"
,
"logs/simple
.txt"
);
simple
_logger
->
info
(
"Some log message"
);
auto
my_logger
=
spd
::
basic_logger_mt
(
"basic_logger"
,
"logs/basic
.txt"
);
my
_logger
->
info
(
"Some log message"
);
// Create a file rotating logger with 5mb size max and 3 rotated files
auto
file_logger
=
spd
::
rotating_logger_mt
(
"file_logger
"
,
"logs/mylogfile"
,
1048576
*
5
,
3
);
auto
rotating_logger
=
spd
::
rotating_logger_mt
(
"some_logger_name
"
,
"logs/mylogfile"
,
1048576
*
5
,
3
);
for
(
int
i
=
0
;
i
<
10
;
++
i
)
file
_logger
->
info
(
"{} * {} equals {:>10}"
,
i
,
i
,
i
*
i
);
rotating
_logger
->
info
(
"{} * {} equals {:>10}"
,
i
,
i
,
i
*
i
);
// Create a daily logger - a new file is created every day on 2:30am
auto
daily_logger
=
spd
::
daily_logger_mt
(
"daily_logger"
,
"logs/daily"
,
2
,
30
);
// Customize msg format for all messages
spd
::
set_pattern
(
"*** [%H:%M:%S %z] [thread %t] %v ***"
);
file
_logger
->
info
(
"This is another message with custom format"
);
rotating
_logger
->
info
(
"This is another message with custom format"
);
// Compile time debug or trace macros.
...
...
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