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
4637cf35
Commit
4637cf35
authored
Dec 07, 2014
by
gabi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved perf by using const char* instead of std::string& when accepting format strings
parent
77886e76
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
23 deletions
+23
-23
line_logger.h
include/spdlog/details/line_logger.h
+1
-1
logger_impl.h
include/spdlog/details/logger_impl.h
+11
-11
logger.h
include/spdlog/logger.h
+11
-11
No files found.
include/spdlog/details/line_logger.h
View file @
4637cf35
...
...
@@ -71,7 +71,7 @@ public:
template
<
typename
...
Args
>
void
write
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
)
void
write
(
const
char
*
fmt
,
const
Args
&
...
args
)
{
if
(
!
_enabled
)
return
;
...
...
include/spdlog/details/logger_impl.h
View file @
4637cf35
...
...
@@ -67,7 +67,7 @@ inline void spdlog::logger::set_pattern(const std::string& 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
char
*
fmt
,
const
Args
&
...
args
)
{
bool
msg_enabled
=
should_log
(
lvl
);
details
::
line_logger
l
(
this
,
lvl
,
msg_enabled
);
...
...
@@ -76,61 +76,61 @@ inline spdlog::details::line_logger spdlog::logger::_log(level::level_enum lvl,
}
template
<
typename
...
Args
>
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
log
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
)
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
log
(
const
char
*
fmt
,
const
Args
&
...
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
)
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
trace
(
const
char
*
fmt
,
const
Args
&
...
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
)
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
debug
(
const
char
*
fmt
,
const
Args
&
...
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
)
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
info
(
const
char
*
fmt
,
const
Args
&
...
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
)
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
notice
(
const
char
*
fmt
,
const
Args
&
...
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
)
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
warn
(
const
char
*
fmt
,
const
Args
&
...
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
)
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
error
(
const
char
*
fmt
,
const
Args
&
...
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
)
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
critical
(
const
char
*
fmt
,
const
Args
&
...
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
)
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
alert
(
const
char
*
fmt
,
const
Args
&
...
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
)
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
emerg
(
const
char
*
fmt
,
const
Args
&
...
args
)
{
return
_log
(
level
::
EMERG
,
fmt
,
args
...);
}
...
...
include/spdlog/logger.h
View file @
4637cf35
...
...
@@ -65,16 +65,16 @@ public:
//Stop logging
void
stop
();
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
);
template
<
typename
...
Args
>
details
::
line_logger
info
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
notice
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
warn
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
error
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
critical
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
);
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
);
template
<
typename
...
Args
>
details
::
line_logger
log
(
const
char
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
trace
(
const
char
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
debug
(
const
char
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
info
(
const
char
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
notice
(
const
char
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
warn
(
const
char
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
error
(
const
char
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
critical
(
const
char
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
alert
(
const
char
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
emerg
(
const
char
*
fmt
,
const
Args
&
...
args
);
//API to support logger.info() << ".." calls
...
...
@@ -100,7 +100,7 @@ protected:
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
);
template
<
typename
...
Args
>
details
::
line_logger
_log
(
level
::
level_enum
lvl
,
const
char
*
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