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
a43a44bb
Commit
a43a44bb
authored
May 27, 2018
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update example
parent
cfbc8e52
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
16 deletions
+7
-16
example/example.cpp
example/example.cpp
+7
-16
No files found.
example/example.cpp
View file @
a43a44bb
...
...
@@ -80,9 +80,8 @@ int main(int, char *[])
SPDLOG_TRACE
(
console
,
"Enabled only #ifdef SPDLOG_TRACE_ON..{} ,{}"
,
1
,
3.23
);
SPDLOG_DEBUG
(
console
,
"Enabled only #ifdef SPDLOG_DEBUG_ON.. {} ,{}"
,
1
,
3.23
);
// Asynchronous logging is very fast..
// Just call spdlog::set_async_mode(q_size) and all created loggers from now on will be asynchronous..
// async_example();
// Asynchronous logging example
async_example
();
// Log user-defined types example
user_defined_example
();
...
...
@@ -107,22 +106,14 @@ int main(int, char *[])
#include "spdlog/async.h"
void
async_example
()
{
//
auto async_file = spd::basic_logger_mt<spdlog::create_async>("async_file_logger", "logs/async_log.txt");
auto
async_file
=
spd
::
basic_logger_mt
<
spdlog
::
create_async
>
(
"async_file_logger"
,
"logs/async_log.txt"
);
for
(
int
j
=
0
;
j
<
1
;
j
++
)
// thread pool settings can be modified *before* creating the async logger:
// spdlog::init_thread_pool(32768, 4); // queue with max 32k items 4 backing threads.
for
(
int
i
=
0
;
i
<
100
;
++
i
)
{
spdlog
::
init_thread_pool
(
1024
,
10
);
auto
async_file
=
spd
::
stderr_color_mt
<
spdlog
::
create_async
>
(
"console"
);
for
(
int
i
=
0
;
i
<
1024
;
++
i
)
{
async_file
->
info
(
"{} Async message #{}"
,
j
,
i
);
}
spdlog
::
drop_all
();
async_file
->
info
(
"Async message #{}"
,
i
+
1
);
}
// std::this_thread::sleep_for(std::chrono::seconds(1));
// you can also modify thread pool settings *before* creating the logger:
// spdlog::init_thread_pool(32768, 4); // queue with max 32k items 4 backing threads.
}
// syslog example (linux/osx/freebsd)
...
...
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