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
862d2f6f
Commit
862d2f6f
authored
May 12, 2017
by
Gabi Melman
Committed by
GitHub
May 12, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #442 from sidyhe/feature
add wide string to utf8 string support
parents
47006c4e
8ee6d385
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
0 deletions
+73
-0
include/spdlog/details/logger_impl.h
include/spdlog/details/logger_impl.h
+57
-0
include/spdlog/logger.h
include/spdlog/logger.h
+10
-0
include/spdlog/tweakme.h
include/spdlog/tweakme.h
+6
-0
No files found.
include/spdlog/details/logger_impl.h
View file @
862d2f6f
...
...
@@ -195,6 +195,63 @@ inline void spdlog::logger::critical(const T& msg)
log
(
level
::
critical
,
msg
);
}
#ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT
#include <codecvt>
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
log
(
level
::
level_enum
lvl
,
const
wchar_t
*
msg
)
{
std
::
wstring_convert
<
std
::
codecvt_utf8
<
wchar_t
>
>
conv
;
log
(
lvl
,
conv
.
to_bytes
(
msg
));
}
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
log
(
level
::
level_enum
lvl
,
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
{
fmt
::
WMemoryWriter
wWriter
;
wWriter
.
write
(
fmt
,
args
...);
log
(
lvl
,
wWriter
.
c_str
());
}
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
trace
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
{
log
(
level
::
trace
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
debug
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
{
log
(
level
::
debug
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
info
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
{
log
(
level
::
info
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
warn
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
{
log
(
level
::
warn
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
error
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
{
log
(
level
::
err
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
critical
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
{
log
(
level
::
critical
,
fmt
,
args
...);
}
#endif // SPDLOG_WCHAR_TO_UTF8_SUPPORT
...
...
include/spdlog/logger.h
View file @
862d2f6f
...
...
@@ -43,6 +43,16 @@ public:
template
<
typename
Arg1
,
typename
...
Args
>
void
warn
(
const
char
*
fmt
,
const
Arg1
&
,
const
Args
&
...
args
);
template
<
typename
Arg1
,
typename
...
Args
>
void
error
(
const
char
*
fmt
,
const
Arg1
&
,
const
Args
&
...
args
);
template
<
typename
Arg1
,
typename
...
Args
>
void
critical
(
const
char
*
fmt
,
const
Arg1
&
,
const
Args
&
...
args
);
#ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT
template
<
typename
...
Args
>
void
log
(
level
::
level_enum
lvl
,
const
wchar_t
*
msg
);
template
<
typename
...
Args
>
void
log
(
level
::
level_enum
lvl
,
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
void
trace
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
void
debug
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
void
info
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
void
warn
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
void
error
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
void
critical
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
#endif // SPDLOG_WCHAR_TO_UTF8_SUPPORT
template
<
typename
T
>
void
log
(
level
::
level_enum
lvl
,
const
T
&
);
template
<
typename
T
>
void
trace
(
const
T
&
);
...
...
include/spdlog/tweakme.h
View file @
862d2f6f
...
...
@@ -101,6 +101,12 @@
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Uncomment to enable wchar_t support (convert to utf8)
//
// #define SPDLOG_WCHAR_TO_UTF8_SUPPORT
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Uncomment to prevent child processes from inheriting log file descriptors
//
...
...
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