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
d3c1ad29
Commit
d3c1ad29
authored
Aug 20, 2018
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize logging for const char* messages
parent
23db7a21
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
8 deletions
+7
-8
include/spdlog/details/fmt_helper.h
include/spdlog/details/fmt_helper.h
+2
-6
include/spdlog/details/logger_impl.h
include/spdlog/details/logger_impl.h
+5
-2
No files found.
include/spdlog/details/fmt_helper.h
View file @
d3c1ad29
...
...
@@ -22,12 +22,8 @@ inline void append_str(const std::string &str, fmt::basic_memory_buffer<char, Bu
template
<
size_t
Buffer_Size
>
inline
void
append_c_str
(
const
char
*
c_str
,
fmt
::
basic_memory_buffer
<
char
,
Buffer_Size
>
&
dest
)
{
char
ch
;
while
((
ch
=
*
c_str
)
!=
'\0'
)
{
dest
.
push_back
(
ch
);
++
c_str
;
}
auto
len
=
std
::
char_traits
<
char
>::
length
(
c_str
);
dest
.
append
(
c_str
,
c_str
+
len
);
}
template
<
size_t
Buffer_Size1
,
size_t
Buffer_Size2
>
...
...
include/spdlog/details/logger_impl.h
View file @
d3c1ad29
...
...
@@ -5,9 +5,12 @@
#pragma once
#include "spdlog/details/fmt_helper.h"
#include <memory>
#include <string>
// create logger with given name, sinks and the default pattern formatter
// all other ctors will call this one
template
<
typename
It
>
...
...
@@ -77,7 +80,7 @@ inline void spdlog::logger::log(level::level_enum lvl, const char *msg)
try
{
details
::
log_msg
log_msg
(
&
name_
,
lvl
);
fmt
::
format_to
(
log_msg
.
raw
,
"{}"
,
msg
);
details
::
fmt_helper
::
append_c_str
(
msg
,
log_msg
.
raw
);
sink_it_
(
log_msg
);
}
SPDLOG_CATCH_AND_HANDLE
...
...
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