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
73b31e4d
Commit
73b31e4d
authored
Nov 29, 2014
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
astyle
parent
8d253244
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
564 additions
and
291 deletions
+564
-291
bench/g2log-bench-mt.cpp
bench/g2log-bench-mt.cpp
+1
-1
bench/g2log-bench.cpp
bench/g2log-bench.cpp
+3
-3
bench/spdlog-bench-async.cpp
bench/spdlog-bench-async.cpp
+2
-2
bench/spdlog-bench-mt-async.cpp
bench/spdlog-bench-mt-async.cpp
+2
-2
example/bench.cpp
example/bench.cpp
+7
-7
include/spdlog/details/format.h
include/spdlog/details/format.h
+544
-273
include/spdlog/details/mpcs_q.h
include/spdlog/details/mpcs_q.h
+4
-2
include/spdlog/details/pattern_formatter_impl.h
include/spdlog/details/pattern_formatter_impl.h
+1
-1
No files found.
bench/g2log-bench-mt.cpp
View file @
73b31e4d
...
...
@@ -19,7 +19,7 @@ int main(int argc, char* argv[])
g2LogWorker
g2log
(
argv
[
0
],
"logs"
);
g2
::
initializeLogging
(
&
g2log
);
std
::
atomic
<
int
>
msg_counter
{
0
};
vector
<
thread
>
threads
;
...
...
bench/g2log-bench.cpp
View file @
73b31e4d
...
...
@@ -5,10 +5,10 @@
int
main
(
int
,
char
*
argv
[])
{
int
howmany
=
1000000
;
g2LogWorker
g2log
(
argv
[
0
],
"logs"
);
g2LogWorker
g2log
(
argv
[
0
],
"logs"
);
g2
::
initializeLogging
(
&
g2log
);
for
(
int
i
=
0
;
i
<
howmany
;
++
i
)
LOG
(
INFO
)
<<
"g2log message # "
<<
i
<<
": This is some text for your pleasure"
;
...
...
bench/spdlog-bench-async.cpp
View file @
73b31e4d
...
...
@@ -6,13 +6,13 @@ int main(int, char* [])
{
int
howmany
=
1000000
;
namespace
spd
=
spdlog
;
spd
::
set_async_mode
(
2500
,
std
::
chrono
::
seconds
(
0
));
spd
::
set_async_mode
(
2500
,
std
::
chrono
::
seconds
(
0
));
///Create a file rotating logger with 5mb size max and 3 rotated files
auto
logger
=
spd
::
rotating_logger_mt
(
"file_logger"
,
"logs/spd-sample"
,
10
*
1024
*
1024
,
5
);
logger
->
set_pattern
(
"[%Y-%b-%d %T.%e]: %v"
);
for
(
int
i
=
0
;
i
<
howmany
;
++
i
)
logger
->
info
()
<<
"spdlog message #"
<<
i
<<
": This is some text for your pleasure"
;
spd
::
stop
();
spd
::
stop
();
return
0
;
}
bench/spdlog-bench-mt-async.cpp
View file @
73b31e4d
...
...
@@ -17,7 +17,7 @@ int main(int argc, char* argv[])
int
howmany
=
1000000
;
namespace
spd
=
spdlog
;
spd
::
set_async_mode
(
2500
,
std
::
chrono
::
seconds
(
0
));
spd
::
set_async_mode
(
2500
,
std
::
chrono
::
seconds
(
0
));
///Create a file rotating logger with 5mb size max and 3 rotated files
auto
logger
=
spd
::
rotating_logger_mt
(
"file_logger"
,
"logs/spd-sample"
,
10
*
1024
*
1024
,
5
);
...
...
@@ -45,6 +45,6 @@ int main(int argc, char* argv[])
t
.
join
();
};
spd
::
stop
();
spd
::
stop
();
return
0
;
}
example/bench.cpp
View file @
73b31e4d
...
...
@@ -52,7 +52,7 @@ int main(int argc, char* argv[])
int
howmany
=
1000000
;
int
threads
=
10
;
bool
auto_flush
=
false
;
bool
auto_flush
=
false
;
int
file_size
=
30
*
1024
*
1024
;
int
rotating_files
=
5
;
...
...
@@ -79,22 +79,22 @@ int main(int argc, char* argv[])
cout
<<
"*******************************************************************************
\n
"
;
auto
rotating_mt
=
spdlog
::
rotating_logger_mt
(
"rotating_mt"
,
"logs/rotating_mt"
,
file_size
,
rotating_files
,
auto_flush
);
bench_mt
(
howmany
,
rotating_mt
,
threads
);
bench_mt
(
howmany
,
rotating_mt
,
threads
);
auto
daily_mt
=
spdlog
::
daily_logger_mt
(
"daily_mt"
,
"logs/daily_mt"
,
auto_flush
);
bench_mt
(
howmany
,
daily_mt
,
threads
);
bench
(
howmany
,
spdlog
::
create
<
null_sink_st
>
(
"null_mt"
));
cout
<<
"
\n
*******************************************************************************
\n
"
;
cout
<<
"async logging.. "
<<
threads
<<
" threads sharing same logger, "
<<
format
(
howmany
)
<<
" iterations, auto_flush="
<<
auto_flush
<<
endl
;
cout
<<
"*******************************************************************************
\n
"
;
cout
<<
"*******************************************************************************
\n
"
;
spdlog
::
set_async_mode
(
2500
);
auto
daily_st_async
=
spdlog
::
daily_logger_st
(
"daily_async"
,
"logs/daily_async"
,
auto_flush
);
bench_mt
(
howmany
,
daily_st_async
,
threads
);
bench_mt
(
howmany
,
daily_st_async
,
threads
);
spdlog
::
stop
();
}
...
...
include/spdlog/details/format.h
View file @
73b31e4d
This diff is collapsed.
Click to expand it.
include/spdlog/details/mpcs_q.h
View file @
73b31e4d
...
...
@@ -61,8 +61,10 @@ should not be interpreted as representing official policies, either expressed or
#include <atomic>
namespace
spdlog
{
namespace
details
{
namespace
spdlog
{
namespace
details
{
template
<
typename
T
>
class
mpsc_q
{
...
...
include/spdlog/details/pattern_formatter_impl.h
View file @
73b31e4d
...
...
@@ -429,7 +429,7 @@ inline void spdlog::pattern_formatter::handle_flag(char flag)
{
switch
(
flag
)
{
// logger name
// logger name
case
'n'
:
_formatters
.
push_back
(
std
::
unique_ptr
<
details
::
flag_formatter
>
(
new
details
::
name_formatter
()));
break
;
...
...
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