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
26cf0b38
Commit
26cf0b38
authored
Dec 02, 2014
by
gabi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support for API of the form logger.info() << ..
parent
58970bf1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
98 additions
and
15 deletions
+98
-15
include/spdlog/details/logger_impl.h
include/spdlog/details/logger_impl.h
+82
-13
include/spdlog/logger.h
include/spdlog/logger.h
+16
-2
No files found.
include/spdlog/details/logger_impl.h
View file @
26cf0b38
...
...
@@ -63,10 +63,11 @@ inline void spdlog::logger::set_pattern(const std::string& pattern)
_set_pattern
(
pattern
);
}
//
// cppformat API of the form logger.info("hello {} {}", "world", 1);
//
template
<
typename
...
Args
>
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
log
(
level
::
level_enum
lvl
,
const
std
::
string
&
fmt
,
const
Args
&
...
args
)
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
_
log
(
level
::
level_enum
lvl
,
const
std
::
string
&
fmt
,
const
Args
&
...
args
)
{
bool
msg_enabled
=
should_log
(
lvl
);
details
::
line_logger
l
(
this
,
lvl
,
msg_enabled
);
...
...
@@ -88,63 +89,131 @@ inline spdlog::details::line_logger spdlog::logger::log(level::level_enum lvl, c
template
<
typename
...
Args
>
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
log
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
)
{
return
log
(
level
::
ALWAYS
,
fmt
,
args
...);
return
_
log
(
level
::
ALWAYS
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
trace
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
)
{
return
log
(
level
::
TRACE
,
fmt
,
args
...);
return
_
log
(
level
::
TRACE
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
debug
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
)
{
return
log
(
level
::
DEBUG
,
fmt
,
args
...);
return
_
log
(
level
::
DEBUG
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
info
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
)
{
return
log
(
level
::
INFO
,
fmt
,
args
...);
return
_
log
(
level
::
INFO
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
notice
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
)
{
return
log
(
level
::
NOTICE
,
fmt
,
args
...);
return
_
log
(
level
::
NOTICE
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
warn
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
)
{
return
log
(
level
::
WARN
,
fmt
,
args
...);
return
_
log
(
level
::
WARN
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
error
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
)
{
return
log
(
level
::
ERR
,
fmt
,
args
...);
return
_
log
(
level
::
ERR
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
critical
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
)
{
return
log
(
level
::
CRITICAL
,
fmt
,
args
...);
return
_
log
(
level
::
CRITICAL
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
alert
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
)
{
return
log
(
level
::
ALERT
,
fmt
,
args
...);
return
_
log
(
level
::
ALERT
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
emerg
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
)
{
return
log
(
level
::
EMERG
,
fmt
,
args
...);
return
_log
(
level
::
EMERG
,
fmt
,
args
...);
}
//
// //API to support logger.info() << ".." calls
//
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
_log
(
level
::
level_enum
lvl
)
{
bool
msg_enabled
=
should_log
(
lvl
);
details
::
line_logger
l
(
this
,
lvl
,
msg_enabled
);
return
l
;
}
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
log
()
{
return
_log
(
level
::
ALWAYS
);
}
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
trace
()
{
return
_log
(
level
::
TRACE
);
}
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
debug
()
{
return
_log
(
level
::
DEBUG
);
}
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
info
()
{
return
_log
(
level
::
INFO
);
}
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
notice
()
{
return
_log
(
level
::
NOTICE
);
}
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
warn
()
{
return
_log
(
level
::
WARN
);
}
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
error
()
{
return
_log
(
level
::
ERR
);
}
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
critical
()
{
return
_log
(
level
::
CRITICAL
);
}
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
alert
()
{
return
_log
(
level
::
ALERT
);
}
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
emerg
()
{
return
_log
(
level
::
EMERG
);
}
//
inline
const
std
::
string
&
spdlog
::
logger
::
name
()
const
{
return
_name
;
...
...
include/spdlog/logger.h
View file @
26cf0b38
...
...
@@ -65,7 +65,6 @@ public:
//Stop logging
void
stop
();
template
<
typename
...
Args
>
details
::
line_logger
log
(
level
::
level_enum
lvl
,
const
std
::
string
&
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
log
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
trace
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
debug
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
);
...
...
@@ -77,16 +76,31 @@ public:
template
<
typename
...
Args
>
details
::
line_logger
alert
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
emerg
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
);
//API to support logger.info() << ".." calls
details
::
line_logger
log
();
details
::
line_logger
trace
();
details
::
line_logger
debug
();
details
::
line_logger
info
();
details
::
line_logger
notice
();
details
::
line_logger
warn
();
details
::
line_logger
error
();
details
::
line_logger
critical
();
details
::
line_logger
alert
();
details
::
line_logger
emerg
();
void
set_pattern
(
const
std
::
string
&
);
void
set_formatter
(
formatter_ptr
);
protected:
virtual
void
_log_msg
(
details
::
log_msg
&
msg
);
virtual
void
_log_msg
(
details
::
log_msg
&
);
virtual
void
_set_pattern
(
const
std
::
string
&
);
virtual
void
_set_formatter
(
formatter_ptr
);
virtual
void
_stop
();
details
::
line_logger
_log
(
level
::
level_enum
lvl
);
template
<
typename
...
Args
>
details
::
line_logger
_log
(
level
::
level_enum
lvl
,
const
std
::
string
&
fmt
,
const
Args
&
...
args
);
friend
details
::
line_logger
;
...
...
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