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
017088d0
Commit
017088d0
authored
Nov 05, 2014
by
gabime
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/gabime/spdlog
parents
8b51b3b2
35c71f4d
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
47 additions
and
44 deletions
+47
-44
README.md
README.md
+1
-0
Makefile
bench/Makefile
+0
-0
boost-bench-mt.cpp
bench/boost-bench-mt.cpp
+0
-0
boost-bench.cpp
bench/boost-bench.cpp
+0
-0
.gitignore
bench/logs/.gitignore
+0
-0
run_all.sh
bench/run_all.sh
+0
-0
spdlog-bench-mt.cpp
bench/spdlog-bench-mt.cpp
+0
-0
spdlog-bench.cpp
bench/spdlog-bench.cpp
+0
-0
Makefile.mingw
example/Makefile.mingw
+32
-0
bench.cpp
example/bench.cpp
+1
-3
example.cpp
example/example.cpp
+1
-1
logger_impl.h
include/spdlog/details/logger_impl.h
+1
-3
registry.h
include/spdlog/details/registry.h
+2
-2
spdlog_impl.h
include/spdlog/details/spdlog_impl.h
+2
-2
logger.h
include/spdlog/logger.h
+2
-1
async_sink.h
include/spdlog/sinks/async_sink.h
+1
-9
file_sinks.h
include/spdlog/sinks/file_sinks.h
+1
-12
null_sink.h
include/spdlog/sinks/null_sink.h
+1
-4
ostream_sink.h
include/spdlog/sinks/ostream_sink.h
+0
-4
sink.h
include/spdlog/sinks/sink.h
+0
-1
spdlog.h
include/spdlog/spdlog.h
+2
-2
No files found.
README.md
View file @
017088d0
...
...
@@ -11,6 +11,7 @@ Just copy the files to your build tree and use a C++11 compiler
*
gcc 4.8.1 and above
*
clang 3.5
*
visual studio 2013
*
mingw with g++ 4.9.x
##Features
*
Very fast - performance is the primary goal (see becnhmarks below)
...
...
bench
-comparison
/Makefile
→
bench/Makefile
View file @
017088d0
File moved
bench
-comparison
/boost-bench-mt.cpp
→
bench/boost-bench-mt.cpp
View file @
017088d0
File moved
bench
-comparison
/boost-bench.cpp
→
bench/boost-bench.cpp
View file @
017088d0
File moved
bench
-comparison
/logs/.gitignore
→
bench/logs/.gitignore
View file @
017088d0
File moved
bench
-comparison
/run_all.sh
→
bench/run_all.sh
View file @
017088d0
File moved
bench
-comparison
/spdlog-bench-mt.cpp
→
bench/spdlog-bench-mt.cpp
View file @
017088d0
File moved
bench
-comparison
/spdlog-bench.cpp
→
bench/spdlog-bench.cpp
View file @
017088d0
File moved
example/Makefile.mingw
0 → 100644
View file @
017088d0
CXX
=
g++
CXXFLAGS
=
-D_WIN32_WINNT
=
0x600
-march
=
native
-Wall
-Wextra
-Wshadow
-pedantic
-std
=
c++11
-pthread
-Wl
,--no-as-needed
-I
../include
CXX_RELEASE_FLAGS
=
-O3
CXX_DEBUG_FLAGS
=
-g
all
:
example bench
debug
:
example-debug bench-debug
example
:
example.cpp
$(CXX)
example.cpp
-o
example
$(CXXFLAGS)
$(CXX_RELEASE_FLAGS)
bench
:
bench.cpp
$(CXX)
bench.cpp
-o
bench
$(CXXFLAGS)
$(CXX_RELEASE_FLAGS)
example-debug
:
example.cpp
$(CXX)
example.cpp
-o
example-debug
$(CXXFLAGS)
$(CXX_DEBUG_FLAGS)
bench-debug
:
bench.cpp
$(CXX)
bench.cpp
-o
bench-debug
$(CXXFLAGS)
$(CXX_DEBUG_FLAGS)
clean
:
rm
-f
*
.o logs/
*
.txt example example-debug bench bench-debug
rebuild
:
clean all
rebuild-debug
:
clean debug
example/bench.cpp
View file @
017088d0
...
...
@@ -105,14 +105,13 @@ void bench(int howmany, std::shared_ptr<spdlog::logger> log)
auto
start
=
system_clock
::
now
();
for
(
auto
i
=
0
;
i
<
howmany
;
++
i
)
{
log
->
info
(
"Hello logger: msg number "
)
<<
i
<<
"**************************"
<<
i
+
1
<<
","
<<
1
+
2
;
;
log
->
info
(
"Hello logger: msg number "
,
i
)
;
}
auto
delta
=
system_clock
::
now
()
-
start
;
auto
delta_d
=
duration_cast
<
duration
<
double
>>
(
delta
).
count
();
cout
<<
format
(
int
(
howmany
/
delta_d
))
<<
"/sec"
<<
endl
;
log
->
close
();
}
...
...
@@ -146,6 +145,5 @@ void bench_mt(int howmany, std::shared_ptr<spdlog::logger> log, int thread_count
auto
delta
=
system_clock
::
now
()
-
start
;
auto
delta_d
=
duration_cast
<
duration
<
double
>>
(
delta
).
count
();
cout
<<
format
(
int
(
howmany
/
delta_d
))
<<
"/sec"
<<
endl
;
log
->
close
();
}
example/example.cpp
View file @
017088d0
...
...
@@ -29,7 +29,7 @@
#include "spdlog/spdlog.h"
int
main
(
int
,
char
*
[])
int
main
a
(
int
,
char
*
[])
{
namespace
spd
=
spdlog
;
...
...
include/spdlog/details/logger_impl.h
View file @
017088d0
...
...
@@ -137,11 +137,9 @@ inline bool spdlog::logger::should_log(spdlog::level::level_enum msg_level) cons
return
msg_level
>=
_level
.
load
();
}
inline
void
spdlog
::
logger
::
close
()
inline
void
spdlog
::
logger
::
stop
()
{
set_level
(
level
::
OFF
);
for
(
auto
&
sink
:
_sinks
)
sink
->
close
();
}
...
...
include/spdlog/details/registry.h
View file @
017088d0
...
...
@@ -104,12 +104,12 @@ public:
}
void
close
_all
()
void
stop
_all
()
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
_mutex
);
_level
=
level
::
OFF
;
for
(
auto
&
l
:
_loggers
)
l
.
second
->
close
();
l
.
second
->
stop
();
}
...
...
include/spdlog/details/spdlog_impl.h
View file @
017088d0
...
...
@@ -116,7 +116,7 @@ inline void spdlog::set_level(level::level_enum log_level)
return
details
::
registry
::
instance
().
set_level
(
log_level
);
}
inline
void
spdlog
::
close
()
inline
void
spdlog
::
stop
()
{
return
details
::
registry
::
instance
().
close
_all
();
return
details
::
registry
::
instance
().
stop
_all
();
}
include/spdlog/logger.h
View file @
017088d0
...
...
@@ -67,7 +67,8 @@ public:
const
std
::
string
&
name
()
const
;
bool
should_log
(
level
::
level_enum
)
const
;
void
close
();
//Stop logging
void
stop
();
template
<
typename
...
Args
>
details
::
line_logger
log
(
level
::
level_enum
lvl
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
log
(
const
Args
&
...
args
);
...
...
include/spdlog/sinks/async_sink.h
View file @
017088d0
...
...
@@ -57,8 +57,6 @@ public:
//Wait to remaining items (if any) in the queue to be written and shutdown
void
shutdown
(
const
std
::
chrono
::
milliseconds
&
timeout
);
void
close
()
override
;
protected
:
...
...
@@ -144,16 +142,12 @@ inline void spdlog::sinks::async_sink::shutdown(const std::chrono::milliseconds&
auto
until
=
log_clock
::
now
()
+
timeout
;
while
(
_q
.
size
()
>
0
&&
log_clock
::
now
()
<
until
)
{
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
milliseconds
(
2
));
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
milliseconds
(
5
));
}
}
_shutdown
();
}
inline
void
spdlog
::
sinks
::
async_sink
::
close
()
{
_shutdown
();
}
inline
void
spdlog
::
sinks
::
async_sink
::
_shutdown
()
...
...
@@ -166,7 +160,5 @@ inline void spdlog::sinks::async_sink::_shutdown()
_back_thread
.
join
();
}
for
(
auto
&
s
:
_sinks
)
s
->
close
();
}
include/spdlog/sinks/file_sinks.h
View file @
017088d0
...
...
@@ -50,10 +50,7 @@ public:
{
_file_helper
.
open
(
filename
);
}
void
close
()
override
{
_file_helper
.
close
();
}
protected
:
void
_sink_it
(
const
details
::
log_msg
&
msg
)
override
{
...
...
@@ -86,10 +83,6 @@ public:
_file_helper
.
open
(
calc_filename
(
_base_filename
,
0
,
_extension
));
}
void
close
()
override
{
_file_helper
.
close
();
}
protected
:
void
_sink_it
(
const
details
::
log_msg
&
msg
)
override
...
...
@@ -171,10 +164,6 @@ public:
_file_helper
.
open
(
calc_filename
(
_base_filename
,
_extension
));
}
void
close
()
override
{
_file_helper
.
close
();
}
protected
:
void
_sink_it
(
const
details
::
log_msg
&
msg
)
override
...
...
include/spdlog/sinks/null_sink.h
View file @
017088d0
...
...
@@ -34,16 +34,13 @@ namespace sinks
{
template
<
class
Mutex
>
class
null_sink
:
public
base_sink
<
Mutex
>
class
null_sink
:
public
base_sink
<
Mutex
>
{
protected
:
void
_sink_it
(
const
details
::
log_msg
&
)
override
{}
void
close
()
override
{}
};
typedef
null_sink
<
details
::
null_mutex
>
null_sink_st
;
typedef
null_sink
<
std
::
mutex
>
null_sink_mt
;
...
...
include/spdlog/sinks/ostream_sink.h
View file @
017088d0
...
...
@@ -44,10 +44,6 @@ public:
ostream_sink
&
operator
=
(
const
ostream_sink
&
)
=
delete
;
virtual
~
ostream_sink
()
=
default
;
void
close
()
override
{}
protected
:
virtual
void
_sink_it
(
const
details
::
log_msg
&
msg
)
override
{
...
...
include/spdlog/sinks/sink.h
View file @
017088d0
...
...
@@ -35,7 +35,6 @@ class sink
public
:
virtual
~
sink
()
{}
virtual
void
log
(
const
details
::
log_msg
&
msg
)
=
0
;
virtual
void
close
()
=
0
;
};
}
}
...
...
include/spdlog/spdlog.h
View file @
017088d0
...
...
@@ -88,8 +88,8 @@ std::shared_ptr<spdlog::logger> create(const std::string& logger_name, const Arg
// Set global formatter object
void
set_formatter
(
formatter_ptr
f
);
//
Close all loggers and stop logging
void
close
();
//
Stop logging by setting all the loggers to log level OFF
void
stop
();
//
...
...
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