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
74b02687
Commit
74b02687
authored
Nov 28, 2015
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor example fix
parent
06ffde63
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
example/example.cpp
example/example.cpp
+9
-2
tests/file_log.cpp
tests/file_log.cpp
+1
-1
No files found.
example/example.cpp
View file @
74b02687
...
...
@@ -93,8 +93,9 @@ int main(int, char*[])
size_t
q_size
=
1048576
;
//queue size must be power of 2
spdlog
::
set_async_mode
(
q_size
);
auto
async_file
=
spd
::
daily_logger_st
(
"async_file_logger"
,
"logs/async_log.txt"
);
async_file
->
info
()
<<
"This is async log.."
<<
"Should be very fast!"
;
spdlog
::
drop_all
();
//Close all loggers
for
(
int
i
=
0
;
i
<
100
;
++
i
)
async_file
->
info
(
"Async message #{}"
,
i
);
//
// syslog example. linux only..
//
...
...
@@ -103,7 +104,13 @@ int main(int, char*[])
auto
syslog_logger
=
spd
::
syslog_logger
(
"syslog"
,
ident
,
LOG_PID
);
syslog_logger
->
warn
(
"This is warning that will end up in syslog. This is Linux only!"
);
#endif
//
//Release and close all loggers
//
spdlog
::
drop_all
();
}
catch
(
const
spd
::
spdlog_ex
&
ex
)
{
std
::
cout
<<
"Log failed: "
<<
ex
.
what
()
<<
std
::
endl
;
...
...
tests/file_log.cpp
View file @
74b02687
...
...
@@ -52,7 +52,7 @@ TEST_CASE("simple_file_logger", "[simple_logger]]")
auto
logger
=
spdlog
::
create
<
spdlog
::
sinks
::
simple_file_sink_mt
>
(
"logger"
,
filename
);
logger
->
set_pattern
(
"%v"
);
logger
->
info
(
"Test message {}"
,
1
);
logger
->
info
(
"Test message {}"
,
2
);
logger
->
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