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
8d253244
Commit
8d253244
authored
Nov 29, 2014
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
continue with cppformatter integration
parent
0629c519
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
11 deletions
+6
-11
bench/Makefile
bench/Makefile
+1
-1
bench/spdlog-bench-mt.cpp
bench/spdlog-bench-mt.cpp
+1
-1
example/bench.cpp
example/bench.cpp
+2
-2
example/example.cpp
example/example.cpp
+2
-7
No files found.
bench/Makefile
View file @
8d253244
CXX
=
g++
CXXFLAGS
=
-g
-march
=
native
-Wall
-Wextra
-
Wshadow
-
pedantic
-std
=
c++11
-pthread
-Wl
,--no-as-needed
-I
../include
CXXFLAGS
=
-g
-march
=
native
-Wall
-Wextra
-pedantic
-std
=
c++11
-pthread
-Wl
,--no-as-needed
-I
../include
CXX_RELEASE_FLAGS
=
-O3
-flto
...
...
bench/spdlog-bench-mt.cpp
View file @
8d253244
...
...
@@ -18,7 +18,7 @@ int main(int argc, char* argv[])
namespace
spd
=
spdlog
;
///Create a file rotating logger with 5mb size max and 5 rotated files
auto
logger
=
spd
::
rotating_logger_mt
(
"file_logger"
,
"logs/spd-sample"
,
10
*
1024
*
1024
,
5
);
auto
logger
=
spd
::
rotating_logger_mt
(
"file_logger"
,
"logs/spd-sample"
,
10
*
1024
*
1024
,
5
,
false
);
logger
->
set_pattern
(
"[%Y-%b-%d %T.%e]: %v"
);
...
...
example/bench.cpp
View file @
8d253244
...
...
@@ -52,7 +52,7 @@ int main(int argc, char* argv[])
int
howmany
=
1000000
;
int
threads
=
10
;
bool
auto_flush
=
tru
e
;
bool
auto_flush
=
fals
e
;
int
file_size
=
30
*
1024
*
1024
;
int
rotating_files
=
5
;
...
...
@@ -79,7 +79,7 @@ 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
);
...
...
example/example.cpp
View file @
8d253244
...
...
@@ -45,16 +45,12 @@ int main(int, char* [])
auto
console
=
spd
::
stdout_logger_mt
(
"console"
);
console
->
info
(
"Welcome to spdlog!"
)
;
console
->
info
(
"An info message example"
,
"..."
,
1
,
2
,
3.5
);
console
->
info
()
<<
"Streams are supported too "
<<
std
::
setw
(
5
)
<<
std
::
setfill
(
'0'
)
<<
1
;
console
->
info
()
<<
"Streams are supported too "
<<
1
;
//Create a file rotating logger with 5mb size max and 3 rotated files
auto
file_logger
=
spd
::
rotating_logger_mt
(
"file_logger"
,
filename
,
1024
*
1024
*
5
,
3
);
file_logger
->
info
(
"Log file message number"
,
1
);
for
(
int
i
=
0
;
i
<
100
;
++
i
)
{
file_logger
->
info
(
i
,
"in hex is"
,
"0x"
)
<<
std
::
hex
<<
std
::
uppercase
<<
i
;
}
spd
::
set_pattern
(
"*** [%H:%M:%S %z] [thread %t] %v ***"
);
file_logger
->
info
(
"This is another message with custom format"
);
...
...
@@ -67,10 +63,9 @@ int main(int, char* [])
// Asynchronous logging is easy..
// Just call spdlog::set_async_mode(max_q_size) and all created loggers from now on will be asynchronous..
//
size_t
max_q_size
=
100000
;
spdlog
::
set_async_mode
(
max_q_size
);
auto
async_file
=
spd
::
daily_logger_st
(
"async_file_logger"
,
"
async_"
+
filename
);
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!"
;
//
...
...
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