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
4445f6f8
Commit
4445f6f8
authored
Mar 16, 2018
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
formatting
parent
4ee89877
Changes
26
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
524 additions
and
247 deletions
+524
-247
bench/g2log-async.cpp
bench/g2log-async.cpp
+2
-1
bench/latency/utils.h
bench/latency/utils.h
+4
-2
bench/utils.h
bench/utils.h
+4
-2
example/example.cpp
example/example.cpp
+2
-1
example/jni/example.cpp
example/jni/example.cpp
+2
-1
example/utils.h
example/utils.h
+4
-2
include/spdlog/details/logger_impl.h
include/spdlog/details/logger_impl.h
+46
-23
include/spdlog/details/mpmc_bounded_q.h
include/spdlog/details/mpmc_bounded_q.h
+2
-1
include/spdlog/details/registry.h
include/spdlog/details/registry.h
+4
-2
include/spdlog/fmt/bundled/format.h
include/spdlog/fmt/bundled/format.h
+293
-143
include/spdlog/fmt/bundled/ostream.h
include/spdlog/fmt/bundled/ostream.h
+6
-3
include/spdlog/fmt/bundled/printf.h
include/spdlog/fmt/bundled/printf.h
+42
-21
include/spdlog/fmt/bundled/time.h
include/spdlog/fmt/bundled/time.h
+2
-1
include/spdlog/logger.h
include/spdlog/logger.h
+68
-24
include/spdlog/sinks/ansicolor_sink.h
include/spdlog/sinks/ansicolor_sink.h
+6
-3
include/spdlog/sinks/base_sink.h
include/spdlog/sinks/base_sink.h
+2
-1
include/spdlog/sinks/dist_sink.h
include/spdlog/sinks/dist_sink.h
+2
-1
include/spdlog/sinks/file_sinks.h
include/spdlog/sinks/file_sinks.h
+6
-3
include/spdlog/sinks/msvc_sink.h
include/spdlog/sinks/msvc_sink.h
+2
-1
include/spdlog/sinks/null_sink.h
include/spdlog/sinks/null_sink.h
+2
-1
include/spdlog/sinks/ostream_sink.h
include/spdlog/sinks/ostream_sink.h
+2
-1
include/spdlog/sinks/stdout_sinks.h
include/spdlog/sinks/stdout_sinks.h
+4
-2
include/spdlog/sinks/wincolor_sink.h
include/spdlog/sinks/wincolor_sink.h
+6
-3
include/spdlog/sinks/windebug_sink.h
include/spdlog/sinks/windebug_sink.h
+2
-1
include/spdlog/spdlog.h
include/spdlog/spdlog.h
+7
-2
tests/test_misc.cpp
tests/test_misc.cpp
+2
-1
No files found.
bench/g2log-async.cpp
View file @
4445f6f8
...
@@ -13,7 +13,8 @@
...
@@ -13,7 +13,8 @@
#include "g2logworker.h"
#include "g2logworker.h"
using
namespace
std
;
using
namespace
std
;
template
<
typename
T
>
std
::
string
format
(
const
T
&
value
);
template
<
typename
T
>
std
::
string
format
(
const
T
&
value
);
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
...
...
bench/latency/utils.h
View file @
4445f6f8
...
@@ -11,7 +11,8 @@
...
@@ -11,7 +11,8 @@
namespace
utils
{
namespace
utils
{
template
<
typename
T
>
inline
std
::
string
format
(
const
T
&
value
)
template
<
typename
T
>
inline
std
::
string
format
(
const
T
&
value
)
{
{
static
std
::
locale
loc
(
""
);
static
std
::
locale
loc
(
""
);
std
::
stringstream
ss
;
std
::
stringstream
ss
;
...
@@ -20,7 +21,8 @@ template<typename T> inline std::string format(const T &value)
...
@@ -20,7 +21,8 @@ template<typename T> inline std::string format(const T &value)
return
ss
.
str
();
return
ss
.
str
();
}
}
template
<
>
inline
std
::
string
format
(
const
double
&
value
)
template
<
>
inline
std
::
string
format
(
const
double
&
value
)
{
{
static
std
::
locale
loc
(
""
);
static
std
::
locale
loc
(
""
);
std
::
stringstream
ss
;
std
::
stringstream
ss
;
...
...
bench/utils.h
View file @
4445f6f8
...
@@ -11,7 +11,8 @@
...
@@ -11,7 +11,8 @@
namespace
utils
{
namespace
utils
{
template
<
typename
T
>
inline
std
::
string
format
(
const
T
&
value
)
template
<
typename
T
>
inline
std
::
string
format
(
const
T
&
value
)
{
{
static
std
::
locale
loc
(
""
);
static
std
::
locale
loc
(
""
);
std
::
stringstream
ss
;
std
::
stringstream
ss
;
...
@@ -20,7 +21,8 @@ template<typename T> inline std::string format(const T &value)
...
@@ -20,7 +21,8 @@ template<typename T> inline std::string format(const T &value)
return
ss
.
str
();
return
ss
.
str
();
}
}
template
<
>
inline
std
::
string
format
(
const
double
&
value
)
template
<
>
inline
std
::
string
format
(
const
double
&
value
)
{
{
static
std
::
locale
loc
(
""
);
static
std
::
locale
loc
(
""
);
std
::
stringstream
ss
;
std
::
stringstream
ss
;
...
...
example/example.cpp
View file @
4445f6f8
...
@@ -133,7 +133,8 @@ void android_example()
...
@@ -133,7 +133,8 @@ void android_example()
struct
my_type
struct
my_type
{
{
int
i
;
int
i
;
template
<
typename
OStream
>
friend
OStream
&
operator
<<
(
OStream
&
os
,
const
my_type
&
c
)
template
<
typename
OStream
>
friend
OStream
&
operator
<<
(
OStream
&
os
,
const
my_type
&
c
)
{
{
return
os
<<
"[my_type i="
<<
c
.
i
<<
"]"
;
return
os
<<
"[my_type i="
<<
c
.
i
<<
"]"
;
}
}
...
...
example/jni/example.cpp
View file @
4445f6f8
...
@@ -133,7 +133,8 @@ void android_example()
...
@@ -133,7 +133,8 @@ void android_example()
struct
my_type
struct
my_type
{
{
int
i
;
int
i
;
template
<
typename
OStream
>
friend
OStream
&
operator
<<
(
OStream
&
os
,
const
my_type
&
c
)
template
<
typename
OStream
>
friend
OStream
&
operator
<<
(
OStream
&
os
,
const
my_type
&
c
)
{
{
return
os
<<
"[my_type i="
<<
c
.
i
<<
"]"
;
return
os
<<
"[my_type i="
<<
c
.
i
<<
"]"
;
}
}
...
...
example/utils.h
View file @
4445f6f8
...
@@ -11,7 +11,8 @@
...
@@ -11,7 +11,8 @@
namespace
utils
{
namespace
utils
{
template
<
typename
T
>
inline
std
::
string
format
(
const
T
&
value
)
template
<
typename
T
>
inline
std
::
string
format
(
const
T
&
value
)
{
{
static
std
::
locale
loc
(
""
);
static
std
::
locale
loc
(
""
);
std
::
stringstream
ss
;
std
::
stringstream
ss
;
...
@@ -20,7 +21,8 @@ template<typename T> inline std::string format(const T &value)
...
@@ -20,7 +21,8 @@ template<typename T> inline std::string format(const T &value)
return
ss
.
str
();
return
ss
.
str
();
}
}
template
<
>
inline
std
::
string
format
(
const
double
&
value
)
template
<
>
inline
std
::
string
format
(
const
double
&
value
)
{
{
static
std
::
locale
loc
(
""
);
static
std
::
locale
loc
(
""
);
std
::
stringstream
ss
;
std
::
stringstream
ss
;
...
...
include/spdlog/details/logger_impl.h
View file @
4445f6f8
...
@@ -50,7 +50,8 @@ inline void spdlog::logger::set_pattern(const std::string &pattern, pattern_time
...
@@ -50,7 +50,8 @@ inline void spdlog::logger::set_pattern(const std::string &pattern, pattern_time
_set_pattern
(
pattern
,
pattern_time
);
_set_pattern
(
pattern
,
pattern_time
);
}
}
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
log
(
level
::
level_enum
lvl
,
const
char
*
fmt
,
const
Args
&
...
args
)
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
log
(
level
::
level_enum
lvl
,
const
char
*
fmt
,
const
Args
&
...
args
)
{
{
if
(
!
should_log
(
lvl
))
if
(
!
should_log
(
lvl
))
return
;
return
;
...
@@ -77,7 +78,8 @@ template<typename... Args> inline void spdlog::logger::log(level::level_enum lvl
...
@@ -77,7 +78,8 @@ template<typename... Args> inline void spdlog::logger::log(level::level_enum lvl
}
}
}
}
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
log
(
level
::
level_enum
lvl
,
const
char
*
msg
)
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
log
(
level
::
level_enum
lvl
,
const
char
*
msg
)
{
{
if
(
!
should_log
(
lvl
))
if
(
!
should_log
(
lvl
))
return
;
return
;
...
@@ -98,7 +100,8 @@ template<typename... Args> inline void spdlog::logger::log(level::level_enum lvl
...
@@ -98,7 +100,8 @@ template<typename... Args> inline void spdlog::logger::log(level::level_enum lvl
}
}
}
}
template
<
typename
T
>
inline
void
spdlog
::
logger
::
log
(
level
::
level_enum
lvl
,
const
T
&
msg
)
template
<
typename
T
>
inline
void
spdlog
::
logger
::
log
(
level
::
level_enum
lvl
,
const
T
&
msg
)
{
{
if
(
!
should_log
(
lvl
))
if
(
!
should_log
(
lvl
))
return
;
return
;
...
@@ -119,62 +122,74 @@ template<typename T> inline void spdlog::logger::log(level::level_enum lvl, cons
...
@@ -119,62 +122,74 @@ template<typename T> inline void spdlog::logger::log(level::level_enum lvl, cons
}
}
}
}
template
<
typename
Arg1
,
typename
...
Args
>
inline
void
spdlog
::
logger
::
trace
(
const
char
*
fmt
,
const
Arg1
&
arg1
,
const
Args
&
...
args
)
template
<
typename
Arg1
,
typename
...
Args
>
inline
void
spdlog
::
logger
::
trace
(
const
char
*
fmt
,
const
Arg1
&
arg1
,
const
Args
&
...
args
)
{
{
log
(
level
::
trace
,
fmt
,
arg1
,
args
...);
log
(
level
::
trace
,
fmt
,
arg1
,
args
...);
}
}
template
<
typename
Arg1
,
typename
...
Args
>
inline
void
spdlog
::
logger
::
debug
(
const
char
*
fmt
,
const
Arg1
&
arg1
,
const
Args
&
...
args
)
template
<
typename
Arg1
,
typename
...
Args
>
inline
void
spdlog
::
logger
::
debug
(
const
char
*
fmt
,
const
Arg1
&
arg1
,
const
Args
&
...
args
)
{
{
log
(
level
::
debug
,
fmt
,
arg1
,
args
...);
log
(
level
::
debug
,
fmt
,
arg1
,
args
...);
}
}
template
<
typename
Arg1
,
typename
...
Args
>
inline
void
spdlog
::
logger
::
info
(
const
char
*
fmt
,
const
Arg1
&
arg1
,
const
Args
&
...
args
)
template
<
typename
Arg1
,
typename
...
Args
>
inline
void
spdlog
::
logger
::
info
(
const
char
*
fmt
,
const
Arg1
&
arg1
,
const
Args
&
...
args
)
{
{
log
(
level
::
info
,
fmt
,
arg1
,
args
...);
log
(
level
::
info
,
fmt
,
arg1
,
args
...);
}
}
template
<
typename
Arg1
,
typename
...
Args
>
inline
void
spdlog
::
logger
::
warn
(
const
char
*
fmt
,
const
Arg1
&
arg1
,
const
Args
&
...
args
)
template
<
typename
Arg1
,
typename
...
Args
>
inline
void
spdlog
::
logger
::
warn
(
const
char
*
fmt
,
const
Arg1
&
arg1
,
const
Args
&
...
args
)
{
{
log
(
level
::
warn
,
fmt
,
arg1
,
args
...);
log
(
level
::
warn
,
fmt
,
arg1
,
args
...);
}
}
template
<
typename
Arg1
,
typename
...
Args
>
inline
void
spdlog
::
logger
::
error
(
const
char
*
fmt
,
const
Arg1
&
arg1
,
const
Args
&
...
args
)
template
<
typename
Arg1
,
typename
...
Args
>
inline
void
spdlog
::
logger
::
error
(
const
char
*
fmt
,
const
Arg1
&
arg1
,
const
Args
&
...
args
)
{
{
log
(
level
::
err
,
fmt
,
arg1
,
args
...);
log
(
level
::
err
,
fmt
,
arg1
,
args
...);
}
}
template
<
typename
Arg1
,
typename
...
Args
>
inline
void
spdlog
::
logger
::
critical
(
const
char
*
fmt
,
const
Arg1
&
arg1
,
const
Args
&
...
args
)
template
<
typename
Arg1
,
typename
...
Args
>
inline
void
spdlog
::
logger
::
critical
(
const
char
*
fmt
,
const
Arg1
&
arg1
,
const
Args
&
...
args
)
{
{
log
(
level
::
critical
,
fmt
,
arg1
,
args
...);
log
(
level
::
critical
,
fmt
,
arg1
,
args
...);
}
}
template
<
typename
T
>
inline
void
spdlog
::
logger
::
trace
(
const
T
&
msg
)
template
<
typename
T
>
inline
void
spdlog
::
logger
::
trace
(
const
T
&
msg
)
{
{
log
(
level
::
trace
,
msg
);
log
(
level
::
trace
,
msg
);
}
}
template
<
typename
T
>
inline
void
spdlog
::
logger
::
debug
(
const
T
&
msg
)
template
<
typename
T
>
inline
void
spdlog
::
logger
::
debug
(
const
T
&
msg
)
{
{
log
(
level
::
debug
,
msg
);
log
(
level
::
debug
,
msg
);
}
}
template
<
typename
T
>
inline
void
spdlog
::
logger
::
info
(
const
T
&
msg
)
template
<
typename
T
>
inline
void
spdlog
::
logger
::
info
(
const
T
&
msg
)
{
{
log
(
level
::
info
,
msg
);
log
(
level
::
info
,
msg
);
}
}
template
<
typename
T
>
inline
void
spdlog
::
logger
::
warn
(
const
T
&
msg
)
template
<
typename
T
>
inline
void
spdlog
::
logger
::
warn
(
const
T
&
msg
)
{
{
log
(
level
::
warn
,
msg
);
log
(
level
::
warn
,
msg
);
}
}
template
<
typename
T
>
inline
void
spdlog
::
logger
::
error
(
const
T
&
msg
)
template
<
typename
T
>
inline
void
spdlog
::
logger
::
error
(
const
T
&
msg
)
{
{
log
(
level
::
err
,
msg
);
log
(
level
::
err
,
msg
);
}
}
template
<
typename
T
>
inline
void
spdlog
::
logger
::
critical
(
const
T
&
msg
)
template
<
typename
T
>
inline
void
spdlog
::
logger
::
critical
(
const
T
&
msg
)
{
{
log
(
level
::
critical
,
msg
);
log
(
level
::
critical
,
msg
);
}
}
...
@@ -183,14 +198,16 @@ template<typename T> inline void spdlog::logger::critical(const T &msg)
...
@@ -183,14 +198,16 @@ template<typename T> inline void spdlog::logger::critical(const T &msg)
#include <codecvt>
#include <codecvt>
#include <locale>
#include <locale>
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
log
(
level
::
level_enum
lvl
,
const
wchar_t
*
msg
)
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
log
(
level
::
level_enum
lvl
,
const
wchar_t
*
msg
)
{
{
std
::
wstring_convert
<
std
::
codecvt_utf8
<
wchar_t
>>
conv
;
std
::
wstring_convert
<
std
::
codecvt_utf8
<
wchar_t
>>
conv
;
log
(
lvl
,
conv
.
to_bytes
(
msg
));
log
(
lvl
,
conv
.
to_bytes
(
msg
));
}
}
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
log
(
level
::
level_enum
lvl
,
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
log
(
level
::
level_enum
lvl
,
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
{
{
fmt
::
WMemoryWriter
wWriter
;
fmt
::
WMemoryWriter
wWriter
;
...
@@ -198,32 +215,38 @@ template<typename... Args> inline void spdlog::logger::log(level::level_enum lvl
...
@@ -198,32 +215,38 @@ template<typename... Args> inline void spdlog::logger::log(level::level_enum lvl
log
(
lvl
,
wWriter
.
c_str
());
log
(
lvl
,
wWriter
.
c_str
());
}
}
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
trace
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
trace
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
{
{
log
(
level
::
trace
,
fmt
,
args
...);
log
(
level
::
trace
,
fmt
,
args
...);
}
}
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
debug
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
debug
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
{
{
log
(
level
::
debug
,
fmt
,
args
...);
log
(
level
::
debug
,
fmt
,
args
...);
}
}
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
info
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
info
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
{
{
log
(
level
::
info
,
fmt
,
args
...);
log
(
level
::
info
,
fmt
,
args
...);
}
}
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
warn
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
warn
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
{
{
log
(
level
::
warn
,
fmt
,
args
...);
log
(
level
::
warn
,
fmt
,
args
...);
}
}
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
error
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
error
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
{
{
log
(
level
::
err
,
fmt
,
args
...);
log
(
level
::
err
,
fmt
,
args
...);
}
}
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
critical
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
critical
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
{
{
log
(
level
::
critical
,
fmt
,
args
...);
log
(
level
::
critical
,
fmt
,
args
...);
}
}
...
...
include/spdlog/details/mpmc_bounded_q.h
View file @
4445f6f8
...
@@ -50,7 +50,8 @@ Distributed under the MIT License (http://opensource.org/licenses/MIT)
...
@@ -50,7 +50,8 @@ Distributed under the MIT License (http://opensource.org/licenses/MIT)
namespace
spdlog
{
namespace
details
{
namespace
spdlog
{
namespace
details
{
template
<
typename
T
>
class
mpmc_bounded_queue
template
<
typename
T
>
class
mpmc_bounded_queue
{
{
public:
public:
using
item_type
=
T
;
using
item_type
=
T
;
...
...
include/spdlog/details/registry.h
View file @
4445f6f8
...
@@ -23,7 +23,8 @@
...
@@ -23,7 +23,8 @@
#include <unordered_map>
#include <unordered_map>
namespace
spdlog
{
namespace
details
{
namespace
spdlog
{
namespace
details
{
template
<
class
Mutex
>
class
registry_t
template
<
class
Mutex
>
class
registry_t
{
{
public:
public:
registry_t
<
Mutex
>
(
const
registry_t
<
Mutex
>
&
)
=
delete
;
registry_t
<
Mutex
>
(
const
registry_t
<
Mutex
>
&
)
=
delete
;
...
@@ -44,7 +45,8 @@ public:
...
@@ -44,7 +45,8 @@ public:
return
found
==
_loggers
.
end
()
?
nullptr
:
found
->
second
;
return
found
==
_loggers
.
end
()
?
nullptr
:
found
->
second
;
}
}
template
<
class
It
>
std
::
shared_ptr
<
logger
>
create
(
const
std
::
string
&
logger_name
,
const
It
&
sinks_begin
,
const
It
&
sinks_end
)
template
<
class
It
>
std
::
shared_ptr
<
logger
>
create
(
const
std
::
string
&
logger_name
,
const
It
&
sinks_begin
,
const
It
&
sinks_end
)
{
{
std
::
lock_guard
<
Mutex
>
lock
(
_mutex
);
std
::
lock_guard
<
Mutex
>
lock
(
_mutex
);
throw_if_exists
(
logger_name
);
throw_if_exists
(
logger_name
);
...
...
include/spdlog/fmt/bundled/format.h
View file @
4445f6f8
This diff is collapsed.
Click to expand it.
include/spdlog/fmt/bundled/ostream.h
View file @
4445f6f8
...
@@ -17,7 +17,8 @@ namespace fmt {
...
@@ -17,7 +17,8 @@ namespace fmt {
namespace
internal
{
namespace
internal
{
template
<
class
Char
>
class
FormatBuf
:
public
std
::
basic_streambuf
<
Char
>
template
<
class
Char
>
class
FormatBuf
:
public
std
::
basic_streambuf
<
Char
>
{
{
private:
private:
typedef
typename
std
::
basic_streambuf
<
Char
>::
int_type
int_type
;
typedef
typename
std
::
basic_streambuf
<
Char
>::
int_type
int_type
;
...
@@ -60,12 +61,14 @@ struct DummyStream : std::ostream
...
@@ -60,12 +61,14 @@ struct DummyStream : std::ostream
DummyStream
();
// Suppress a bogus warning in MSVC.
DummyStream
();
// Suppress a bogus warning in MSVC.
// Hide all operator<< overloads from std::ostream.
// Hide all operator<< overloads from std::ostream.
template
<
typename
T
>
typename
EnableIf
<
sizeof
(
T
)
==
0
>::
type
operator
<<
(
const
T
&
);
template
<
typename
T
>
typename
EnableIf
<
sizeof
(
T
)
==
0
>::
type
operator
<<
(
const
T
&
);
};
};
No
&
operator
<<
(
std
::
ostream
&
,
int
);
No
&
operator
<<
(
std
::
ostream
&
,
int
);
template
<
typename
T
>
struct
ConvertToIntImpl
<
T
,
true
>
template
<
typename
T
>
struct
ConvertToIntImpl
<
T
,
true
>
{
{
// Convert to int only if T doesn't have an overloaded operator<<.
// Convert to int only if T doesn't have an overloaded operator<<.
enum
enum
...
...
include/spdlog/fmt/bundled/printf.h
View file @
4445f6f8
...
@@ -20,9 +20,11 @@ namespace internal {
...
@@ -20,9 +20,11 @@ namespace internal {
// Checks if a value fits in int - used to avoid warnings about comparing
// Checks if a value fits in int - used to avoid warnings about comparing
// signed and unsigned integers.
// signed and unsigned integers.
template
<
bool
IsSigned
>
struct
IntChecker
template
<
bool
IsSigned
>
struct
IntChecker
{
{
template
<
typename
T
>
static
bool
fits_in_int
(
T
value
)
template
<
typename
T
>
static
bool
fits_in_int
(
T
value
)
{
{
unsigned
max
=
std
::
numeric_limits
<
int
>::
max
();
unsigned
max
=
std
::
numeric_limits
<
int
>::
max
();
return
value
<=
max
;
return
value
<=
max
;
...
@@ -33,9 +35,11 @@ template<bool IsSigned> struct IntChecker
...
@@ -33,9 +35,11 @@ template<bool IsSigned> struct IntChecker
}
}
};
};
template
<
>
struct
IntChecker
<
true
>
template
<
>
struct
IntChecker
<
true
>
{
{
template
<
typename
T
>
static
bool
fits_in_int
(
T
value
)
template
<
typename
T
>
static
bool
fits_in_int
(
T
value
)
{
{
return
value
>=
std
::
numeric_limits
<
int
>::
min
()
&&
value
<=
std
::
numeric_limits
<
int
>::
max
();
return
value
>=
std
::
numeric_limits
<
int
>::
min
()
&&
value
<=
std
::
numeric_limits
<
int
>::
max
();
}
}
...
@@ -53,7 +57,8 @@ public:
...
@@ -53,7 +57,8 @@ public:
FMT_THROW
(
FormatError
(
"precision is not integer"
));
FMT_THROW
(
FormatError
(
"precision is not integer"
));
}
}
template
<
typename
T
>
int
visit_any_int
(
T
value
)
template
<
typename
T
>
int
visit_any_int
(
T
value
)
{
{
if
(
!
IntChecker
<
std
::
numeric_limits
<
T
>::
is_signed
>::
fits_in_int
(
value
))
if
(
!
IntChecker
<
std
::
numeric_limits
<
T
>::
is_signed
>::
fits_in_int
(
value
))
FMT_THROW
(
FormatError
(
"number is too big"
));
FMT_THROW
(
FormatError
(
"number is too big"
));
...
@@ -65,7 +70,8 @@ public:
...
@@ -65,7 +70,8 @@ public:
class
IsZeroInt
:
public
ArgVisitor
<
IsZeroInt
,
bool
>
class
IsZeroInt
:
public
ArgVisitor
<
IsZeroInt
,
bool
>
{
{
public:
public:
template
<
typename
T
>
bool
visit_any_int
(
T
value
)
template
<
typename
T
>
bool
visit_any_int
(
T
value
)
{
{
return
value
==
0
;
return
value
==
0
;
}
}
...
@@ -90,12 +96,14 @@ public:
...
@@ -90,12 +96,14 @@ public:
return
'p'
;
return
'p'
;
}
}
template
<
typename
T
>
char
visit_any_int
(
T
)
template
<
typename
T
>
char
visit_any_int
(
T
)
{
{
return
'd'
;
return
'd'
;
}
}
template
<
typename
T
>
char
visit_any_double
(
T
)
template
<
typename
T
>
char
visit_any_double
(
T
)
{
{
return
'g'
;
return
'g'
;
}
}
...
@@ -106,7 +114,8 @@ public:
...
@@ -106,7 +114,8 @@ public:
}
}
};
};
template
<
typename
T
,
typename
U
>
struct
is_same
template
<
typename
T
,
typename
U
>
struct
is_same
{
{
enum
enum
{
{
...
@@ -114,7 +123,8 @@ template<typename T, typename U> struct is_same
...
@@ -114,7 +123,8 @@ template<typename T, typename U> struct is_same
};
};
};
};
template
<
typename
T
>
struct
is_same
<
T
,
T
>
template
<
typename
T
>
struct
is_same
<
T
,
T
>
{
{
enum
enum
{
{
...
@@ -126,7 +136,8 @@ template<typename T> struct is_same<T, T>
...
@@ -126,7 +136,8 @@ template<typename T> struct is_same<T, T>
// if T is an integral type. If T is void, the argument is converted to
// if T is an integral type. If T is void, the argument is converted to
// corresponding signed or unsigned type depending on the type specifier:
// corresponding signed or unsigned type depending on the type specifier:
// 'd' and 'i' - signed, other - unsigned)
// 'd' and 'i' - signed, other - unsigned)
template
<
typename
T
=
void
>
class
ArgConverter
:
public
ArgVisitor
<
ArgConverter
<
T
>
,
void
>
template
<
typename
T
=
void
>
class
ArgConverter
:
public
ArgVisitor
<
ArgConverter
<
T
>
,
void
>
{
{
private:
private:
internal
::
Arg
&
arg_
;
internal
::
Arg
&
arg_
;
...
@@ -153,7 +164,8 @@ public:
...
@@ -153,7 +164,8 @@ public:
visit_any_int
(
value
);
visit_any_int
(
value
);
}
}
template
<
typename
U
>
void
visit_any_int
(
U
value
)
template
<
typename
U
>
void
visit_any_int
(
U
value
)
{
{
bool
is_signed
=
type_
==
'd'
||
type_
==
'i'
;
bool
is_signed
=
type_
==
'd'
||
type_
==
'i'
;
if
(
type_
==
's'
)
if
(
type_
==
's'
)
...
@@ -211,7 +223,8 @@ public:
...
@@ -211,7 +223,8 @@ public:
{
{
}
}
template
<
typename
T
>
void
visit_any_int
(
T
value
)
template
<
typename
T
>
void
visit_any_int
(
T
value
)
{
{
arg_
.
type
=
internal
::
Arg
::
CHAR
;
arg_
.
type
=
internal
::
Arg
::
CHAR
;
arg_
.
int_value
=
static_cast
<
char
>
(
value
);
arg_
.
int_value
=
static_cast
<
char
>
(
value
);
...
@@ -238,7 +251,8 @@ public:
...
@@ -238,7 +251,8 @@ public:
FMT_THROW
(
FormatError
(
"width is not integer"
));
FMT_THROW
(
FormatError
(
"width is not integer"
));
}
}
template
<
typename
T
>
unsigned
visit_any_int
(
T
value
)
template
<
typename
T
>
unsigned
visit_any_int
(
T
value
)
{
{
typedef
typename
internal
::
IntTraits
<
T
>::
MainType
UnsignedType
;
typedef
typename
internal
::
IntTraits
<
T
>::
MainType
UnsignedType
;
UnsignedType
width
=
static_cast
<
UnsignedType
>
(
value
);
UnsignedType
width
=
static_cast
<
UnsignedType
>
(
value
);
...
@@ -272,7 +286,8 @@ public:
...
@@ -272,7 +286,8 @@ public:
superclass will be called.
superclass will be called.
\endrst
\endrst
*/
*/
template
<
typename
Impl
,
typename
Char
,
typename
Spec
>
class
BasicPrintfArgFormatter
:
public
internal
::
ArgFormatterBase
<
Impl
,
Char
,
Spec
>
template
<
typename
Impl
,
typename
Char
,
typename
Spec
>
class
BasicPrintfArgFormatter
:
public
internal
::
ArgFormatterBase
<
Impl
,
Char
,
Spec
>
{
{
private:
private:
void
write_null_pointer
()
void
write_null_pointer
()
...
@@ -367,7 +382,8 @@ public:
...
@@ -367,7 +382,8 @@ public:
};
};
/** The default printf argument formatter. */
/** The default printf argument formatter. */
template
<
typename
Char
>
class
PrintfArgFormatter
:
public
BasicPrintfArgFormatter
<
PrintfArgFormatter
<
Char
>
,
Char
,
FormatSpec
>
template
<
typename
Char
>
class
PrintfArgFormatter
:
public
BasicPrintfArgFormatter
<
PrintfArgFormatter
<
Char
>
,
Char
,
FormatSpec
>
{
{
public:
public:
/** Constructs an argument formatter object. */
/** Constructs an argument formatter object. */
...
@@ -378,7 +394,8 @@ public:
...
@@ -378,7 +394,8 @@ public:
};
};
/** This template formats data and writes the output to a writer. */
/** This template formats data and writes the output to a writer. */
template
<
typename
Char
,
typename
ArgFormatter
=
PrintfArgFormatter
<
Char
>
>
class
PrintfFormatter
:
private
internal
::
FormatterBase
template
<
typename
Char
,
typename
ArgFormatter
=
PrintfArgFormatter
<
Char
>
>
class
PrintfFormatter
:
private
internal
::
FormatterBase
{
{
private:
private:
BasicWriter
<
Char
>
&
writer_
;
BasicWriter
<
Char
>
&
writer_
;
...
@@ -410,7 +427,8 @@ public:
...
@@ -410,7 +427,8 @@ public:
void
format
(
BasicCStringRef
<
Char
>
format_str
);
void
format
(
BasicCStringRef
<
Char
>
format_str
);
};
};
template
<
typename
Char
,
typename
AF
>
void
PrintfFormatter
<
Char
,
AF
>::
parse_flags
(
FormatSpec
&
spec
,
const
Char
*&
s
)
template
<
typename
Char
,
typename
AF
>
void
PrintfFormatter
<
Char
,
AF
>::
parse_flags
(
FormatSpec
&
spec
,
const
Char
*&
s
)
{
{
for
(;;)
for
(;;)
{
{
...
@@ -438,7 +456,8 @@ template<typename Char, typename AF> void PrintfFormatter<Char, AF>::parse_flags
...
@@ -438,7 +456,8 @@ template<typename Char, typename AF> void PrintfFormatter<Char, AF>::parse_flags
}
}
}
}
template
<
typename
Char
,
typename
AF
>
internal
::
Arg
PrintfFormatter
<
Char
,
AF
>::
get_arg
(
const
Char
*
s
,
unsigned
arg_index
)
template
<
typename
Char
,
typename
AF
>
internal
::
Arg
PrintfFormatter
<
Char
,
AF
>::
get_arg
(
const
Char
*
s
,
unsigned
arg_index
)
{
{
(
void
)
s
;
(
void
)
s
;
const
char
*
error
=
FMT_NULL
;
const
char
*
error
=
FMT_NULL
;
...
@@ -448,7 +467,8 @@ template<typename Char, typename AF> internal::Arg PrintfFormatter<Char, AF>::ge
...
@@ -448,7 +467,8 @@ template<typename Char, typename AF> internal::Arg PrintfFormatter<Char, AF>::ge
return
arg
;
return
arg
;
}
}
template
<
typename
Char
,
typename
AF
>
unsigned
PrintfFormatter
<
Char
,
AF
>::
parse_header
(
const
Char
*&
s
,
FormatSpec
&
spec
)
template
<
typename
Char
,
typename
AF
>
unsigned
PrintfFormatter
<
Char
,
AF
>::
parse_header
(
const
Char
*&
s
,
FormatSpec
&
spec
)
{
{
unsigned
arg_index
=
std
::
numeric_limits
<
unsigned
>::
max
();
unsigned
arg_index
=
std
::
numeric_limits
<
unsigned
>::
max
();
Char
c
=
*
s
;
Char
c
=
*
s
;
...
@@ -489,7 +509,8 @@ template<typename Char, typename AF> unsigned PrintfFormatter<Char, AF>::parse_h
...
@@ -489,7 +509,8 @@ template<typename Char, typename AF> unsigned PrintfFormatter<Char, AF>::parse_h
return
arg_index
;
return
arg_index
;
}
}
template
<
typename
Char
,
typename
AF
>
void
PrintfFormatter
<
Char
,
AF
>::
format
(
BasicCStringRef
<
Char
>
format_str
)
template
<
typename
Char
,
typename
AF
>
void
PrintfFormatter
<
Char
,
AF
>::
format
(
BasicCStringRef
<
Char
>
format_str
)
{
{
const
Char
*
start
=
format_str
.
c_str
();
const
Char
*
start
=
format_str
.
c_str
();
const
Char
*
s
=
start
;
const
Char
*
s
=
start
;
...
...
include/spdlog/fmt/bundled/time.h
View file @
4445f6f8
...
@@ -20,7 +20,8 @@
...
@@ -20,7 +20,8 @@
#endif
#endif
namespace
fmt
{
namespace
fmt
{
template
<
typename
ArgFormatter
>
void
format_arg
(
BasicFormatter
<
char
,
ArgFormatter
>
&
f
,
const
char
*&
format_str
,
const
std
::
tm
&
tm
)
template
<
typename
ArgFormatter
>
void
format_arg
(
BasicFormatter
<
char
,
ArgFormatter
>
&
f
,
const
char
*&
format_str
,
const
std
::
tm
&
tm
)
{
{
if
(
*
format_str
==
':'
)
if
(
*
format_str
==
':'
)
++
format_str
;
++
format_str
;
...
...
include/spdlog/logger.h
View file @
4445f6f8
...
@@ -27,40 +27,84 @@ public:
...
@@ -27,40 +27,84 @@ public:
logger
(
const
std
::
string
&
name
,
sink_ptr
single_sink
);
logger
(
const
std
::
string
&
name
,
sink_ptr
single_sink
);
logger
(
const
std
::
string
&
name
,
sinks_init_list
sinks
);
logger
(
const
std
::
string
&
name
,
sinks_init_list
sinks
);
template
<
class
It
>
logger
(
std
::
string
name
,
const
It
&
begin
,
const
It
&
end
);
template
<
class
It
>
logger
(
std
::
string
name
,
const
It
&
begin
,
const
It
&
end
);
virtual
~
logger
();
virtual
~
logger
();
logger
(
const
logger
&
)
=
delete
;
logger
(
const
logger
&
)
=
delete
;
logger
&
operator
=
(
const
logger
&
)
=
delete
;
logger
&
operator
=
(
const
logger
&
)
=
delete
;
template
<
typename
...
Args
>
void
log
(
level
::
level_enum
lvl
,
const
char
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
template
<
typename
...
Args
>
void
log
(
level
::
level_enum
lvl
,
const
char
*
msg
);
void
log
(
level
::
level_enum
lvl
,
const
char
*
fmt
,
const
Args
&
...
args
);
template
<
typename
Arg1
,
typename
...
Args
>
void
trace
(
const
char
*
fmt
,
const
Arg1
&
,
const
Args
&
...
args
);
template
<
typename
Arg1
,
typename
...
Args
>
void
debug
(
const
char
*
fmt
,
const
Arg1
&
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
template
<
typename
Arg1
,
typename
...
Args
>
void
info
(
const
char
*
fmt
,
const
Arg1
&
,
const
Args
&
...
args
);
void
log
(
level
::
level_enum
lvl
,
const
char
*
msg
);
template
<
typename
Arg1
,
typename
...
Args
>
void
warn
(
const
char
*
fmt
,
const
Arg1
&
,
const
Args
&
...
args
);
template
<
typename
Arg1
,
typename
...
Args
>
void
error
(
const
char
*
fmt
,
const
Arg1
&
,
const
Args
&
...
args
);
template
<
typename
Arg1
,
typename
...
Args
>
template
<
typename
Arg1
,
typename
...
Args
>
void
critical
(
const
char
*
fmt
,
const
Arg1
&
,
const
Args
&
...
args
);
void
trace
(
const
char
*
fmt
,
const
Arg1
&
,
const
Args
&
...
args
);
template
<
typename
Arg1
,
typename
...
Args
>
void
debug
(
const
char
*
fmt
,
const
Arg1
&
,
const
Args
&
...
args
);
template
<
typename
Arg1
,
typename
...
Args
>
void
info
(
const
char
*
fmt
,
const
Arg1
&
,
const
Args
&
...
args
);
template
<
typename
Arg1
,
typename
...
Args
>
void
warn
(
const
char
*
fmt
,
const
Arg1
&
,
const
Args
&
...
args
);
template
<
typename
Arg1
,
typename
...
Args
>
void
error
(
const
char
*
fmt
,
const
Arg1
&
,
const
Args
&
...
args
);
template
<
typename
Arg1
,
typename
...
Args
>
void
critical
(
const
char
*
fmt
,
const
Arg1
&
,
const
Args
&
...
args
);
#ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT
#ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT
template
<
typename
...
Args
>
void
log
(
level
::
level_enum
lvl
,
const
wchar_t
*
msg
);
template
<
typename
...
Args
>
template
<
typename
...
Args
>
void
log
(
level
::
level_enum
lvl
,
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
void
log
(
level
::
level_enum
lvl
,
const
wchar_t
*
msg
);
template
<
typename
...
Args
>
void
trace
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
void
debug
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
template
<
typename
...
Args
>
void
info
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
void
log
(
level
::
level_enum
lvl
,
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
void
warn
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
void
error
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
template
<
typename
...
Args
>
void
critical
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
void
trace
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
void
debug
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
void
info
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
void
warn
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
void
error
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
void
critical
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
#endif // SPDLOG_WCHAR_TO_UTF8_SUPPORT
#endif // SPDLOG_WCHAR_TO_UTF8_SUPPORT
template
<
typename
T
>
void
log
(
level
::
level_enum
lvl
,
const
T
&
);
template
<
typename
T
>
void
trace
(
const
T
&
msg
);
template
<
typename
T
>
void
debug
(
const
T
&
msg
);
template
<
typename
T
>
void
info
(
const
T
&
msg
);
template
<
typename
T
>
void
warn
(
const
T
&
msg
);
template
<
typename
T
>
void
error
(
const
T
&
msg
);
template
<
typename
T
>
void
log
(
level
::
level_enum
lvl
,
const
T
&
);
template
<
typename
T
>
template
<
typename
T
>
void
trace
(
const
T
&
msg
);
void
critical
(
const
T
&
msg
);
template
<
typename
T
>
void
debug
(
const
T
&
msg
);
template
<
typename
T
>
void
info
(
const
T
&
msg
);
template
<
typename
T
>
void
warn
(
const
T
&
msg
);
template
<
typename
T
>
void
error
(
const
T
&
msg
);
template
<
typename
T
>
void
critical
(
const
T
&
msg
);
bool
should_log
(
level
::
level_enum
msg_level
)
const
;
bool
should_log
(
level
::
level_enum
msg_level
)
const
;
void
set_level
(
level
::
level_enum
log_level
);
void
set_level
(
level
::
level_enum
log_level
);
...
...
include/spdlog/sinks/ansicolor_sink.h
View file @
4445f6f8
...
@@ -19,7 +19,8 @@ namespace spdlog { namespace sinks {
...
@@ -19,7 +19,8 @@ namespace spdlog { namespace sinks {
* of the message.
* of the message.
* If no color terminal detected, omit the escape codes.
* If no color terminal detected, omit the escape codes.
*/
*/
template
<
class
Mutex
>
class
ansicolor_sink
:
public
base_sink
<
Mutex
>
template
<
class
Mutex
>
class
ansicolor_sink
:
public
base_sink
<
Mutex
>
{
{
public:
public:
explicit
ansicolor_sink
(
FILE
*
file
)
explicit
ansicolor_sink
(
FILE
*
file
)
...
@@ -106,7 +107,8 @@ protected:
...
@@ -106,7 +107,8 @@ protected:
std
::
unordered_map
<
level
::
level_enum
,
std
::
string
,
level
::
level_hasher
>
colors_
;
std
::
unordered_map
<
level
::
level_enum
,
std
::
string
,
level
::
level_hasher
>
colors_
;
};
};
template
<
class
Mutex
>
class
ansicolor_stdout_sink
:
public
ansicolor_sink
<
Mutex
>
template
<
class
Mutex
>
class
ansicolor_stdout_sink
:
public
ansicolor_sink
<
Mutex
>
{
{
public:
public:
ansicolor_stdout_sink
()
ansicolor_stdout_sink
()
...
@@ -118,7 +120,8 @@ public:
...
@@ -118,7 +120,8 @@ public:
using
ansicolor_stdout_sink_mt
=
ansicolor_stdout_sink
<
std
::
mutex
>
;
using
ansicolor_stdout_sink_mt
=
ansicolor_stdout_sink
<
std
::
mutex
>
;
using
ansicolor_stdout_sink_st
=
ansicolor_stdout_sink
<
details
::
null_mutex
>
;
using
ansicolor_stdout_sink_st
=
ansicolor_stdout_sink
<
details
::
null_mutex
>
;
template
<
class
Mutex
>
class
ansicolor_stderr_sink
:
public
ansicolor_sink
<
Mutex
>
template
<
class
Mutex
>
class
ansicolor_stderr_sink
:
public
ansicolor_sink
<
Mutex
>
{
{
public:
public:
ansicolor_stderr_sink
()
ansicolor_stderr_sink
()
...
...
include/spdlog/sinks/base_sink.h
View file @
4445f6f8
...
@@ -18,7 +18,8 @@
...
@@ -18,7 +18,8 @@
#include <mutex>
#include <mutex>
namespace
spdlog
{
namespace
sinks
{
namespace
spdlog
{
namespace
sinks
{
template
<
class
Mutex
>
class
base_sink
:
public
sink
template
<
class
Mutex
>
class
base_sink
:
public
sink
{
{
public:
public:
base_sink
()
=
default
;
base_sink
()
=
default
;
...
...
include/spdlog/sinks/dist_sink.h
View file @
4445f6f8
...
@@ -18,7 +18,8 @@
...
@@ -18,7 +18,8 @@
// Distribution sink (mux). Stores a vector of sinks which get called when log is called
// Distribution sink (mux). Stores a vector of sinks which get called when log is called
namespace
spdlog
{
namespace
sinks
{
namespace
spdlog
{
namespace
sinks
{
template
<
class
Mutex
>
class
dist_sink
:
public
base_sink
<
Mutex
>
template
<
class
Mutex
>
class
dist_sink
:
public
base_sink
<
Mutex
>
{
{
public:
public:
explicit
dist_sink
()
explicit
dist_sink
()
...
...
include/spdlog/sinks/file_sinks.h
View file @
4445f6f8
...
@@ -22,7 +22,8 @@ namespace spdlog { namespace sinks {
...
@@ -22,7 +22,8 @@ namespace spdlog { namespace sinks {
/*
/*
* Trivial file sink with single file as target
* Trivial file sink with single file as target
*/
*/
template
<
class
Mutex
>
class
simple_file_sink
SPDLOG_FINAL
:
public
base_sink
<
Mutex
>
template
<
class
Mutex
>
class
simple_file_sink
SPDLOG_FINAL
:
public
base_sink
<
Mutex
>
{
{
public:
public:
explicit
simple_file_sink
(
const
filename_t
&
filename
,
bool
truncate
=
false
)
explicit
simple_file_sink
(
const
filename_t
&
filename
,
bool
truncate
=
false
)
...
@@ -60,7 +61,8 @@ using simple_file_sink_st = simple_file_sink<details::null_mutex>;
...
@@ -60,7 +61,8 @@ using simple_file_sink_st = simple_file_sink<details::null_mutex>;
/*
/*
* Rotating file sink based on size
* Rotating file sink based on size
*/
*/
template
<
class
Mutex
>
class
rotating_file_sink
SPDLOG_FINAL
:
public
base_sink
<
Mutex
>
template
<
class
Mutex
>
class
rotating_file_sink
SPDLOG_FINAL
:
public
base_sink
<
Mutex
>
{
{
public:
public:
rotating_file_sink
(
filename_t
base_filename
,
std
::
size_t
max_size
,
std
::
size_t
max_files
)
rotating_file_sink
(
filename_t
base_filename
,
std
::
size_t
max_size
,
std
::
size_t
max_files
)
...
@@ -185,7 +187,8 @@ struct dateonly_daily_file_name_calculator
...
@@ -185,7 +187,8 @@ struct dateonly_daily_file_name_calculator
/*
/*
* Rotating file sink based on date. rotates at midnight
* Rotating file sink based on date. rotates at midnight
*/
*/
template
<
class
Mutex
,
class
FileNameCalc
=
default_daily_file_name_calculator
>
class
daily_file_sink
SPDLOG_FINAL
:
public
base_sink
<
Mutex
>
template
<
class
Mutex
,
class
FileNameCalc
=
default_daily_file_name_calculator
>
class
daily_file_sink
SPDLOG_FINAL
:
public
base_sink
<
Mutex
>
{
{
public:
public:
// create daily file sink which rotates on given time
// create daily file sink which rotates on given time
...
...
include/spdlog/sinks/msvc_sink.h
View file @
4445f6f8
...
@@ -19,7 +19,8 @@ namespace spdlog { namespace sinks {
...
@@ -19,7 +19,8 @@ namespace spdlog { namespace sinks {
/*
/*
* MSVC sink (logging using OutputDebugStringA)
* MSVC sink (logging using OutputDebugStringA)
*/
*/
template
<
class
Mutex
>
class
msvc_sink
:
public
base_sink
<
Mutex
>
template
<
class
Mutex
>
class
msvc_sink
:
public
base_sink
<
Mutex
>
{
{
public:
public:
explicit
msvc_sink
()
{}
explicit
msvc_sink
()
{}
...
...
include/spdlog/sinks/null_sink.h
View file @
4445f6f8
...
@@ -12,7 +12,8 @@
...
@@ -12,7 +12,8 @@
namespace
spdlog
{
namespace
sinks
{
namespace
spdlog
{
namespace
sinks
{
template
<
class
Mutex
>
class
null_sink
:
public
base_sink
<
Mutex
>
template
<
class
Mutex
>
class
null_sink
:
public
base_sink
<
Mutex
>
{
{
protected:
protected:
void
_sink_it
(
const
details
::
log_msg
&
)
override
{}
void
_sink_it
(
const
details
::
log_msg
&
)
override
{}
...
...
include/spdlog/sinks/ostream_sink.h
View file @
4445f6f8
...
@@ -12,7 +12,8 @@
...
@@ -12,7 +12,8 @@
#include <ostream>
#include <ostream>
namespace
spdlog
{
namespace
sinks
{
namespace
spdlog
{
namespace
sinks
{
template
<
class
Mutex
>
class
ostream_sink
:
public
base_sink
<
Mutex
>
template
<
class
Mutex
>
class
ostream_sink
:
public
base_sink
<
Mutex
>
{
{
public:
public:
explicit
ostream_sink
(
std
::
ostream
&
os
,
bool
force_flush
=
false
)
explicit
ostream_sink
(
std
::
ostream
&
os
,
bool
force_flush
=
false
)
...
...
include/spdlog/sinks/stdout_sinks.h
View file @
4445f6f8
...
@@ -14,7 +14,8 @@
...
@@ -14,7 +14,8 @@
namespace
spdlog
{
namespace
sinks
{
namespace
spdlog
{
namespace
sinks
{
template
<
class
Mutex
>
class
stdout_sink
SPDLOG_FINAL
:
public
base_sink
<
Mutex
>
template
<
class
Mutex
>
class
stdout_sink
SPDLOG_FINAL
:
public
base_sink
<
Mutex
>
{
{
using
MyType
=
stdout_sink
<
Mutex
>
;
using
MyType
=
stdout_sink
<
Mutex
>
;
...
@@ -43,7 +44,8 @@ protected:
...
@@ -43,7 +44,8 @@ protected:
using
stdout_sink_mt
=
stdout_sink
<
std
::
mutex
>
;
using
stdout_sink_mt
=
stdout_sink
<
std
::
mutex
>
;
using
stdout_sink_st
=
stdout_sink
<
details
::
null_mutex
>
;
using
stdout_sink_st
=
stdout_sink
<
details
::
null_mutex
>
;
template
<
class
Mutex
>
class
stderr_sink
SPDLOG_FINAL
:
public
base_sink
<
Mutex
>
template
<
class
Mutex
>
class
stderr_sink
SPDLOG_FINAL
:
public
base_sink
<
Mutex
>
{
{
using
MyType
=
stderr_sink
<
Mutex
>
;
using
MyType
=
stderr_sink
<
Mutex
>
;
...
...
include/spdlog/sinks/wincolor_sink.h
View file @
4445f6f8
...
@@ -18,7 +18,8 @@ namespace spdlog { namespace sinks {
...
@@ -18,7 +18,8 @@ namespace spdlog { namespace sinks {
/*
/*
* Windows color console sink. Uses WriteConsoleA to write to the console with colors
* Windows color console sink. Uses WriteConsoleA to write to the console with colors
*/
*/
template
<
class
Mutex
>
class
wincolor_sink
:
public
base_sink
<
Mutex
>
template
<
class
Mutex
>
class
wincolor_sink
:
public
base_sink
<
Mutex
>
{
{
public:
public:
const
WORD
BOLD
=
FOREGROUND_INTENSITY
;
const
WORD
BOLD
=
FOREGROUND_INTENSITY
;
...
@@ -89,7 +90,8 @@ private:
...
@@ -89,7 +90,8 @@ private:
//
//
// windows color console to stdout
// windows color console to stdout
//
//
template
<
class
Mutex
>
class
wincolor_stdout_sink
:
public
wincolor_sink
<
Mutex
>
template
<
class
Mutex
>
class
wincolor_stdout_sink
:
public
wincolor_sink
<
Mutex
>
{
{
public:
public:
wincolor_stdout_sink
()
wincolor_stdout_sink
()
...
@@ -104,7 +106,8 @@ using wincolor_stdout_sink_st = wincolor_stdout_sink<details::null_mutex>;
...
@@ -104,7 +106,8 @@ using wincolor_stdout_sink_st = wincolor_stdout_sink<details::null_mutex>;
//
//
// windows color console to stderr
// windows color console to stderr
//
//
template
<
class
Mutex
>
class
wincolor_stderr_sink
:
public
wincolor_sink
<
Mutex
>
template
<
class
Mutex
>
class
wincolor_stderr_sink
:
public
wincolor_sink
<
Mutex
>
{
{
public:
public:
wincolor_stderr_sink
()
wincolor_stderr_sink
()
...
...
include/spdlog/sinks/windebug_sink.h
View file @
4445f6f8
...
@@ -14,7 +14,8 @@ namespace spdlog { namespace sinks {
...
@@ -14,7 +14,8 @@ namespace spdlog { namespace sinks {
/*
/*
* Windows debug sink (logging using OutputDebugStringA, synonym for msvc_sink)
* Windows debug sink (logging using OutputDebugStringA, synonym for msvc_sink)
*/
*/
template
<
class
Mutex
>
using
windebug_sink
=
msvc_sink
<
Mutex
>
;
template
<
class
Mutex
>
using
windebug_sink
=
msvc_sink
<
Mutex
>
;
using
windebug_sink_mt
=
msvc_sink_mt
;
using
windebug_sink_mt
=
msvc_sink_mt
;
using
windebug_sink_st
=
msvc_sink_st
;
using
windebug_sink_st
=
msvc_sink_st
;
...
...
include/spdlog/spdlog.h
View file @
4445f6f8
...
@@ -81,6 +81,7 @@ std::shared_ptr<logger> basic_logger_st(const std::string &logger_name, const fi
...
@@ -81,6 +81,7 @@ std::shared_ptr<logger> basic_logger_st(const std::string &logger_name, const fi
//
//
std
::
shared_ptr
<
logger
>
rotating_logger_mt
(
std
::
shared_ptr
<
logger
>
rotating_logger_mt
(
const
std
::
string
&
logger_name
,
const
filename_t
&
filename
,
size_t
max_file_size
,
size_t
max_files
);
const
std
::
string
&
logger_name
,
const
filename_t
&
filename
,
size_t
max_file_size
,
size_t
max_files
);
std
::
shared_ptr
<
logger
>
rotating_logger_st
(
std
::
shared_ptr
<
logger
>
rotating_logger_st
(
const
std
::
string
&
logger_name
,
const
filename_t
&
filename
,
size_t
max_file_size
,
size_t
max_files
);
const
std
::
string
&
logger_name
,
const
filename_t
&
filename
,
size_t
max_file_size
,
size_t
max_files
);
...
@@ -122,12 +123,15 @@ std::shared_ptr<logger> create(const std::string &logger_name, const sink_ptr &s
...
@@ -122,12 +123,15 @@ std::shared_ptr<logger> create(const std::string &logger_name, const sink_ptr &s
// Create and register a logger with multiple sinks
// Create and register a logger with multiple sinks
std
::
shared_ptr
<
logger
>
create
(
const
std
::
string
&
logger_name
,
sinks_init_list
sinks
);
std
::
shared_ptr
<
logger
>
create
(
const
std
::
string
&
logger_name
,
sinks_init_list
sinks
);
template
<
class
It
>
std
::
shared_ptr
<
logger
>
create
(
const
std
::
string
&
logger_name
,
const
It
&
sinks_begin
,
const
It
&
sinks_end
);
template
<
class
It
>
std
::
shared_ptr
<
logger
>
create
(
const
std
::
string
&
logger_name
,
const
It
&
sinks_begin
,
const
It
&
sinks_end
);
// Create and register a logger with templated sink type
// Create and register a logger with templated sink type
// Example:
// Example:
// spdlog::create<daily_file_sink_st>("mylog", "dailylog_filename");
// spdlog::create<daily_file_sink_st>("mylog", "dailylog_filename");
template
<
typename
Sink
,
typename
...
Args
>
std
::
shared_ptr
<
spdlog
::
logger
>
create
(
const
std
::
string
&
logger_name
,
Args
...
args
);
template
<
typename
Sink
,
typename
...
Args
>
std
::
shared_ptr
<
spdlog
::
logger
>
create
(
const
std
::
string
&
logger_name
,
Args
...
args
);
// Create and register an async logger with a single sink
// Create and register an async logger with a single sink
std
::
shared_ptr
<
logger
>
create_async
(
const
std
::
string
&
logger_name
,
const
sink_ptr
&
sink
,
size_t
queue_size
,
std
::
shared_ptr
<
logger
>
create_async
(
const
std
::
string
&
logger_name
,
const
sink_ptr
&
sink
,
size_t
queue_size
,
...
@@ -142,6 +146,7 @@ std::shared_ptr<logger> create_async(const std::string &logger_name, sinks_init_
...
@@ -142,6 +146,7 @@ std::shared_ptr<logger> create_async(const std::string &logger_name, sinks_init_
const
std
::
function
<
void
()
>
&
worker_warmup_cb
=
nullptr
,
const
std
::
function
<
void
()
>
&
worker_warmup_cb
=
nullptr
,
const
std
::
chrono
::
milliseconds
&
flush_interval_ms
=
std
::
chrono
::
milliseconds
::
zero
(),
const
std
::
chrono
::
milliseconds
&
flush_interval_ms
=
std
::
chrono
::
milliseconds
::
zero
(),
const
std
::
function
<
void
()
>
&
worker_teardown_cb
=
nullptr
);
const
std
::
function
<
void
()
>
&
worker_teardown_cb
=
nullptr
);
template
<
class
It
>
template
<
class
It
>
std
::
shared_ptr
<
logger
>
create_async
(
const
std
::
string
&
logger_name
,
const
It
&
sinks_begin
,
const
It
&
sinks_end
,
size_t
queue_size
,
std
::
shared_ptr
<
logger
>
create_async
(
const
std
::
string
&
logger_name
,
const
It
&
sinks_begin
,
const
It
&
sinks_end
,
size_t
queue_size
,
const
async_overflow_policy
overflow_policy
=
async_overflow_policy
::
block_retry
,
const
async_overflow_policy
overflow_policy
=
async_overflow_policy
::
block_retry
,
...
...
tests/test_misc.cpp
View file @
4445f6f8
#include "includes.h"
#include "includes.h"
template
<
class
T
>
std
::
string
log_info
(
const
T
&
what
,
spdlog
::
level
::
level_enum
logger_level
=
spdlog
::
level
::
info
)
template
<
class
T
>
std
::
string
log_info
(
const
T
&
what
,
spdlog
::
level
::
level_enum
logger_level
=
spdlog
::
level
::
info
)
{
{
std
::
ostringstream
oss
;
std
::
ostringstream
oss
;
...
...
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