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
c2a9bf99
Commit
c2a9bf99
authored
Oct 19, 2018
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small refactoring and support wchar again
parent
23da9f13
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
7 deletions
+14
-7
fmt_helper.h
include/spdlog/details/fmt_helper.h
+5
-0
logger_impl.h
include/spdlog/details/logger_impl.h
+9
-4
pattern_formatter.h
include/spdlog/details/pattern_formatter.h
+0
-3
No files found.
include/spdlog/details/fmt_helper.h
View file @
c2a9bf99
...
...
@@ -13,6 +13,11 @@ namespace spdlog {
namespace
details
{
namespace
fmt_helper
{
template
<
size_t
Buffer_Size
>
inline
fmt
::
string_view
to_string_view
(
const
fmt
::
basic_memory_buffer
<
char
,
Buffer_Size
>
&
buf
)
SPDLOG_NOEXCEPT
{
return
fmt
::
string_view
(
buf
.
data
(),
buf
.
size
());
}
template
<
size_t
Buffer_Size1
,
size_t
Buffer_Size2
>
inline
void
append_buf
(
const
fmt
::
basic_memory_buffer
<
char
,
Buffer_Size1
>
&
buf
,
fmt
::
basic_memory_buffer
<
char
,
Buffer_Size2
>
&
dest
)
{
...
...
include/spdlog/details/logger_impl.h
View file @
c2a9bf99
...
...
@@ -63,9 +63,10 @@ inline void spdlog::logger::log(level::level_enum lvl, const char *fmt, const Ar
try
{
using
details
::
fmt_helper
::
to_string_view
;
fmt
::
memory_buffer
buf
;
fmt
::
format_to
(
buf
,
fmt
,
args
...);
details
::
log_msg
log_msg
(
&
name_
,
lvl
,
fmt
::
string_view
(
buf
.
data
(),
buf
.
size
()
));
details
::
log_msg
log_msg
(
&
name_
,
lvl
,
to_string_view
(
buf
));
sink_it_
(
log_msg
);
}
SPDLOG_CATCH_AND_HANDLE
...
...
@@ -95,9 +96,10 @@ inline void spdlog::logger::log(level::level_enum lvl, const T &msg)
}
try
{
using
details
::
fmt_helper
::
to_string_view
;
fmt
::
memory_buffer
buf
;
fmt
::
format_to
(
buf
,
"{}"
,
msg
);
details
::
log_msg
log_msg
(
&
name_
,
lvl
,
fmt
::
string_view
(
buf
.
data
(),
buf
.
size
()
));
details
::
log_msg
log_msg
(
&
name_
,
lvl
,
to_string_view
(
buf
));
sink_it_
(
log_msg
);
}
SPDLOG_CATCH_AND_HANDLE
...
...
@@ -209,11 +211,14 @@ inline void spdlog::logger::log(level::level_enum lvl, const wchar_t *fmt, const
try
{
// format to wmemory_buffer and convert to utf8
details
::
log_msg
log_msg
(
&
name_
,
lvl
)
;
using
details
::
fmt_helper
::
to_string_view
;
fmt
::
wmemory_buffer
wbuf
;
fmt
::
format_to
(
wbuf
,
fmt
,
args
...);
wbuf_to_utf8buf
(
wbuf
,
log_msg
.
raw
);
fmt
::
memory_buffer
buf
;
wbuf_to_utf8buf
(
wbuf
,
buf
);
details
::
log_msg
log_msg
(
&
name_
,
lvl
,
to_string_view
(
buf
));
sink_it_
(
log_msg
);
}
SPDLOG_CATCH_AND_HANDLE
}
...
...
include/spdlog/details/pattern_formatter.h
View file @
c2a9bf99
...
...
@@ -83,7 +83,6 @@ class a_formatter : public flag_formatter
{
void
format
(
const
details
::
log_msg
&
,
const
std
::
tm
&
tm_time
,
fmt
::
memory_buffer
&
dest
)
override
{
// fmt_helper::append_string_view(days[tm_time.tm_wday], dest);
fmt_helper
::
append_string_view
(
days
[
tm_time
.
tm_wday
],
dest
);
}
};
...
...
@@ -94,7 +93,6 @@ class A_formatter : public flag_formatter
{
void
format
(
const
details
::
log_msg
&
,
const
std
::
tm
&
tm_time
,
fmt
::
memory_buffer
&
dest
)
override
{
// fmt_helper::append_string_view(full_days[tm_time.tm_wday], dest);
fmt_helper
::
append_string_view
(
full_days
[
tm_time
.
tm_wday
],
dest
);
}
};
...
...
@@ -105,7 +103,6 @@ class b_formatter : public flag_formatter
{
void
format
(
const
details
::
log_msg
&
,
const
std
::
tm
&
tm_time
,
fmt
::
memory_buffer
&
dest
)
override
{
// fmt_helper::append_string_view(months[tm_time.tm_mon], dest);
fmt_helper
::
append_string_view
(
months
[
tm_time
.
tm_mon
],
dest
);
}
};
...
...
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