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
b463b06a
Commit
b463b06a
authored
Jun 17, 2017
by
Asit Kumar Dhal
Browse files
Options
Browse Files
Download
Plain Diff
conditional logging for all levels
parents
9a189bad
ed7c3a83
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
143 additions
and
10 deletions
+143
-10
include/spdlog/details/logger_impl.h
include/spdlog/details/logger_impl.h
+119
-9
include/spdlog/logger.h
include/spdlog/logger.h
+24
-1
No files found.
include/spdlog/details/logger_impl.h
View file @
b463b06a
...
...
@@ -146,7 +146,64 @@ inline void spdlog::logger::warn(const char* fmt, const Arg1 &arg1, const Args&.
log
(
level
::
warn
,
fmt
,
arg1
,
args
...);
}
template
<
typename
Arg1
,
typename
...
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
...);
}
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
...);
}
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
log_if
(
const
bool
flag
,
level
::
level_enum
lvl
,
const
char
*
msg
)
{
if
(
flag
)
{
log
(
lvl
,
msg
);
}
}
template
<
typename
T
>
inline
void
spdlog
::
logger
::
log_if
(
const
bool
flag
,
level
::
level_enum
lvl
,
const
T
&
msg
)
{
if
(
flag
)
{
log
(
lvl
,
msg
);
}
}
template
<
typename
Arg1
,
typename
...
Args
>
inline
void
spdlog
::
logger
::
trace_if
(
const
bool
flag
,
const
char
*
fmt
,
const
Arg1
&
arg1
,
const
Args
&
...
args
)
{
if
(
flag
)
{
log
(
level
::
trace
,
fmt
,
arg1
,
args
...);
}
}
template
<
typename
Arg1
,
typename
...
Args
>
inline
void
spdlog
::
logger
::
debug_if
(
const
bool
flag
,
const
char
*
fmt
,
const
Arg1
&
arg1
,
const
Args
&
...
args
)
{
if
(
flag
)
{
log
(
level
::
debug
,
fmt
,
arg1
,
args
...);
}
}
template
<
typename
Arg1
,
typename
...
Args
>
inline
void
spdlog
::
logger
::
info_if
(
const
bool
flag
,
const
char
*
fmt
,
const
Arg1
&
arg1
,
const
Args
&
...
args
)
{
if
(
flag
)
{
log
(
level
::
info
,
fmt
,
arg1
,
args
...);
}
}
template
<
typename
Arg1
,
typename
...
Args
>
inline
void
spdlog
::
logger
::
warn_if
(
const
bool
flag
,
const
char
*
fmt
,
const
Arg1
&
arg1
,
const
Args
&
...
args
)
{
if
(
flag
)
...
...
@@ -156,17 +213,24 @@ inline void spdlog::logger::warn_if(const bool flag, const char* fmt, const Arg1
}
template
<
typename
Arg1
,
typename
...
Args
>
inline
void
spdlog
::
logger
::
error
(
const
char
*
fmt
,
const
Arg1
&
arg1
,
const
Args
&
...
args
)
inline
void
spdlog
::
logger
::
error
_if
(
const
bool
flag
,
const
char
*
fmt
,
const
Arg1
&
arg1
,
const
Args
&
...
args
)
{
log
(
level
::
err
,
fmt
,
arg1
,
args
...);
if
(
flag
)
{
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
)
inline
void
spdlog
::
logger
::
critical
_if
(
const
bool
flag
,
const
char
*
fmt
,
const
Arg1
&
arg1
,
const
Args
&
...
args
)
{
log
(
level
::
critical
,
fmt
,
arg1
,
args
...);
if
(
flag
)
{
log
(
level
::
critical
,
fmt
,
arg1
,
args
...);
}
}
template
<
typename
T
>
inline
void
spdlog
::
logger
::
trace
(
const
T
&
msg
)
{
...
...
@@ -193,6 +257,45 @@ inline void spdlog::logger::warn(const T& msg)
log
(
level
::
warn
,
msg
);
}
template
<
typename
T
>
inline
void
spdlog
::
logger
::
error
(
const
T
&
msg
)
{
log
(
level
::
err
,
msg
);
}
template
<
typename
T
>
inline
void
spdlog
::
logger
::
critical
(
const
T
&
msg
)
{
log
(
level
::
critical
,
msg
);
}
template
<
typename
T
>
inline
void
spdlog
::
logger
::
trace_if
(
const
bool
flag
,
const
T
&
msg
)
{
if
(
flag
)
{
log
(
level
::
trace
,
msg
);
}
}
template
<
typename
T
>
inline
void
spdlog
::
logger
::
debug_if
(
const
bool
flag
,
const
T
&
msg
)
{
if
(
flag
)
{
log
(
level
::
debug
,
msg
);
}
}
template
<
typename
T
>
inline
void
spdlog
::
logger
::
info_if
(
const
bool
flag
,
const
T
&
msg
)
{
if
(
flag
)
{
log
(
level
::
info
,
msg
);
}
}
template
<
typename
T
>
inline
void
spdlog
::
logger
::
warn_if
(
const
bool
flag
,
const
T
&
msg
)
{
...
...
@@ -203,17 +306,24 @@ inline void spdlog::logger::warn_if(const bool flag, const T& msg)
}
template
<
typename
T
>
inline
void
spdlog
::
logger
::
error
(
const
T
&
msg
)
inline
void
spdlog
::
logger
::
error
_if
(
const
bool
flag
,
const
T
&
msg
)
{
log
(
level
::
err
,
msg
);
if
(
flag
)
{
log
(
level
::
error
,
msg
);
}
}
template
<
typename
T
>
inline
void
spdlog
::
logger
::
critical
(
const
T
&
msg
)
inline
void
spdlog
::
logger
::
critical
_if
(
const
bool
flag
,
const
T
&
msg
)
{
log
(
level
::
critical
,
msg
);
if
(
flag
)
{
log
(
level
::
critical
,
msg
);
}
}
#ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT
#include <codecvt>
...
...
include/spdlog/logger.h
View file @
b463b06a
...
...
@@ -43,8 +43,16 @@ public:
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
);
template
<
typename
...
Args
>
void
log_if
(
const
bool
flag
,
level
::
level_enum
lvl
,
const
char
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
void
log_if
(
const
bool
flag
,
level
::
level_enum
lvl
,
const
char
*
msg
);
template
<
typename
Arg1
,
typename
...
Args
>
void
trace_if
(
const
bool
flag
,
const
char
*
fmt
,
const
Arg1
&
,
const
Args
&
...
args
);
template
<
typename
Arg1
,
typename
...
Args
>
void
debug_if
(
const
bool
flag
,
const
char
*
fmt
,
const
Arg1
&
,
const
Args
&
...
args
);
template
<
typename
Arg1
,
typename
...
Args
>
void
info_if
(
const
bool
flag
,
const
char
*
fmt
,
const
Arg1
&
,
const
Args
&
...
args
);
template
<
typename
Arg1
,
typename
...
Args
>
void
warn_if
(
const
bool
flag
,
const
char
*
fmt
,
const
Arg1
&
,
const
Args
&
...
args
);
template
<
typename
Arg1
,
typename
...
Args
>
void
error_if
(
const
bool
flag
,
const
char
*
fmt
,
const
Arg1
&
,
const
Args
&
...
args
);
template
<
typename
Arg1
,
typename
...
Args
>
void
critical_if
(
const
bool
flag
,
const
char
*
fmt
,
const
Arg1
&
,
const
Args
&
...
args
);
#ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT
template
<
typename
...
Args
>
void
log
(
level
::
level_enum
lvl
,
const
wchar_t
*
msg
);
template
<
typename
...
Args
>
void
log
(
level
::
level_enum
lvl
,
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
...
...
@@ -54,6 +62,15 @@ public:
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
);
template
<
typename
...
Args
>
void
log_if
(
const
bool
flag
,
level
::
level_enum
lvl
,
const
wchar_t
*
msg
);
template
<
typename
...
Args
>
void
log_if
(
const
bool
flag
,
level
::
level_enum
lvl
,
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
void
trace_if
(
const
bool
flag
,
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
void
debug_if
(
const
bool
flag
,
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
void
info_if
(
const
bool
flag
,
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
void
warn_if
(
const
bool
flag
,
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
void
error_if
(
const
bool
flag
,
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
void
critical_if
(
const
bool
flag
,
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
#endif // SPDLOG_WCHAR_TO_UTF8_SUPPORT
template
<
typename
T
>
void
log
(
level
::
level_enum
lvl
,
const
T
&
);
...
...
@@ -64,7 +81,13 @@ public:
template
<
typename
T
>
void
error
(
const
T
&
);
template
<
typename
T
>
void
critical
(
const
T
&
);
template
<
typename
T
>
void
log_if
(
const
bool
flag
,
level
::
level_enum
lvl
,
const
T
&
);
template
<
typename
T
>
void
trace_if
(
const
bool
flag
,
const
T
&
);
template
<
typename
T
>
void
debug_if
(
const
bool
flag
,
const
T
&
);
template
<
typename
T
>
void
info_if
(
const
bool
flag
,
const
T
&
);
template
<
typename
T
>
void
warn_if
(
const
bool
flag
,
const
T
&
);
template
<
typename
T
>
void
error_if
(
const
bool
flag
,
const
T
&
);
template
<
typename
T
>
void
critical_if
(
const
bool
flag
,
const
T
&
);
bool
should_log
(
level
::
level_enum
)
const
;
void
set_level
(
level
::
level_enum
);
...
...
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