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
2ce9a3f7
Unverified
Commit
2ce9a3f7
authored
Jul 24, 2019
by
Charles Milette
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add overload to logger when T can be statically converted to wstring_view_t
parent
59cbdaaf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
1 deletion
+21
-1
logger.h
include/spdlog/logger.h
+21
-1
No files found.
include/spdlog/logger.h
View file @
2ce9a3f7
...
...
@@ -228,7 +228,7 @@ public:
fmt
::
format_to
(
wbuf
,
fmt
,
args
...);
fmt
::
memory_buffer
buf
;
details
::
os
::
wstr_to_utf8buf
(
basic_string_view_t
<
wchar_t
>
(
wbuf
.
data
(),
wbuf
.
size
()),
buf
);
details
::
os
::
wstr_to_utf8buf
(
wstring_view_t
(
wbuf
.
data
(),
wbuf
.
size
()),
buf
);
details
::
log_msg
log_msg
(
source
,
name_
,
lvl
,
string_view_t
(
buf
.
data
(),
buf
.
size
()));
sink_it_
(
log_msg
);
...
...
@@ -277,6 +277,26 @@ public:
{
log
(
level
::
critical
,
fmt
,
args
...);
}
// T can be statically converted to wstring_view
template
<
class
T
,
typename
std
::
enable_if
<
std
::
is_convertible
<
T
,
spdlog
::
wstring_view_t
>::
value
,
T
>::
type
*
=
nullptr
>
void
log
(
source_loc
loc
,
level
::
level_enum
lvl
,
const
T
&
msg
)
{
if
(
!
should_log
(
lvl
))
{
return
;
}
try
{
fmt
::
memory_buffer
buf
;
details
::
os
::
wstr_to_utf8buf
(
msg
,
buf
);
details
::
log_msg
log_msg
(
loc
,
name_
,
lvl
,
buf
);
sink_it_
(
log_msg
);
}
SPDLOG_LOGGER_CATCH
()
}
#endif // _WIN32
#endif // SPDLOG_WCHAR_TO_UTF8_SUPPORT
...
...
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