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
945020e5
Unverified
Commit
945020e5
authored
Jul 06, 2019
by
Gabi Melman
Committed by
GitHub
Jul 06, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1139 from matt77hias/v1.x
Added fmt::(w)string_view support (v2).
parents
ee87aee4
5a7bcd0a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
32 deletions
+39
-32
include/spdlog/common.h
include/spdlog/common.h
+7
-0
include/spdlog/logger.h
include/spdlog/logger.h
+17
-17
include/spdlog/spdlog.h
include/spdlog/spdlog.h
+15
-15
No files found.
include/spdlog/common.h
View file @
945020e5
...
...
@@ -94,6 +94,13 @@ template<typename T>
using
basic_string_view_t
=
fmt
::
basic_string_view
<
T
>
;
#endif
using
string_view_t
=
basic_string_view_t
<
char
>
;
#ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT
#ifndef _WIN32
#error SPDLOG_WCHAR_TO_UTF8_SUPPORT only supported on windows
#else
using
wstring_view_t
=
basic_string_view_t
<
wchar_t
>
;
#endif // _WIN32
#endif // SPDLOG_WCHAR_TO_UTF8_SUPPORT
#if defined(SPDLOG_NO_ATOMIC_LEVELS)
using
level_t
=
details
::
null_atomic_int
;
...
...
include/spdlog/logger.h
View file @
945020e5
...
...
@@ -63,7 +63,7 @@ public:
void
swap
(
spdlog
::
logger
&
other
);
template
<
typename
...
Args
>
void
force_log
(
source_loc
loc
,
level
::
level_enum
lvl
,
const
char
*
fmt
,
const
Args
&
...
args
)
void
force_log
(
source_loc
loc
,
level
::
level_enum
lvl
,
string_view_t
fmt
,
const
Args
&
...
args
)
{
try
{
...
...
@@ -83,7 +83,7 @@ public:
}
template
<
typename
...
Args
>
void
log
(
source_loc
loc
,
level
::
level_enum
lvl
,
const
char
*
fmt
,
const
Args
&
...
args
)
void
log
(
source_loc
loc
,
level
::
level_enum
lvl
,
string_view_t
fmt
,
const
Args
&
...
args
)
{
if
(
should_log
(
lvl
))
{
...
...
@@ -92,7 +92,7 @@ public:
}
template
<
typename
...
Args
>
void
log
(
level
::
level_enum
lvl
,
const
char
*
fmt
,
const
Args
&
...
args
)
void
log
(
level
::
level_enum
lvl
,
string_view_t
fmt
,
const
Args
&
...
args
)
{
log
(
source_loc
{},
lvl
,
fmt
,
args
...);
}
...
...
@@ -101,37 +101,37 @@ public:
void
log
(
level
::
level_enum
lvl
,
const
char
*
msg
);
template
<
typename
...
Args
>
void
trace
(
const
char
*
fmt
,
const
Args
&
...
args
)
void
trace
(
string_view_t
fmt
,
const
Args
&
...
args
)
{
log
(
level
::
trace
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
void
debug
(
const
char
*
fmt
,
const
Args
&
...
args
)
void
debug
(
string_view_t
fmt
,
const
Args
&
...
args
)
{
log
(
level
::
debug
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
void
info
(
const
char
*
fmt
,
const
Args
&
...
args
)
void
info
(
string_view_t
fmt
,
const
Args
&
...
args
)
{
log
(
level
::
info
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
void
warn
(
const
char
*
fmt
,
const
Args
&
...
args
)
void
warn
(
string_view_t
fmt
,
const
Args
&
...
args
)
{
log
(
level
::
warn
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
void
error
(
const
char
*
fmt
,
const
Args
&
...
args
)
void
error
(
string_view_t
fmt
,
const
Args
&
...
args
)
{
log
(
level
::
err
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
void
critical
(
const
char
*
fmt
,
const
Args
&
...
args
)
void
critical
(
string_view_t
fmt
,
const
Args
&
...
args
)
{
log
(
level
::
critical
,
fmt
,
args
...);
}
...
...
@@ -231,7 +231,7 @@ public:
#error SPDLOG_WCHAR_TO_UTF8_SUPPORT only supported on windows
#else
template
<
typename
...
Args
>
void
log
(
source_loc
source
,
level
::
level_enum
lvl
,
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
void
log
(
source_loc
source
,
level
::
level_enum
lvl
,
wstring_view_t
fmt
,
const
Args
&
...
args
)
{
if
(
!
should_log
(
lvl
))
{
...
...
@@ -261,43 +261,43 @@ public:
}
template
<
typename
...
Args
>
void
log
(
level
::
level_enum
lvl
,
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
void
log
(
level
::
level_enum
lvl
,
wstring_view_t
fmt
,
const
Args
&
...
args
)
{
log
(
source_loc
{},
lvl
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
void
trace
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
void
trace
(
wstring_view_t
fmt
,
const
Args
&
...
args
)
{
log
(
level
::
trace
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
void
debug
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
void
debug
(
wstring_view_t
fmt
,
const
Args
&
...
args
)
{
log
(
level
::
debug
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
void
info
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
void
info
(
wstring_view_t
fmt
,
const
Args
&
...
args
)
{
log
(
level
::
info
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
void
warn
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
void
warn
(
wstring_view_t
fmt
,
const
Args
&
...
args
)
{
log
(
level
::
warn
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
void
error
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
void
error
(
wstring_view_t
fmt
,
const
Args
&
...
args
)
{
log
(
level
::
err
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
void
critical
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
void
critical
(
wstring_view_t
fmt
,
const
Args
&
...
args
)
{
log
(
level
::
critical
,
fmt
,
args
...);
}
...
...
include/spdlog/spdlog.h
View file @
945020e5
...
...
@@ -115,49 +115,49 @@ spdlog::logger *default_logger_raw();
void
set_default_logger
(
std
::
shared_ptr
<
spdlog
::
logger
>
default_logger
);
template
<
typename
...
Args
>
inline
void
log
(
source_loc
source
,
level
::
level_enum
lvl
,
const
char
*
fmt
,
const
Args
&
...
args
)
inline
void
log
(
source_loc
source
,
level
::
level_enum
lvl
,
string_view_t
fmt
,
const
Args
&
...
args
)
{
default_logger_raw
()
->
log
(
source
,
lvl
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
void
log
(
level
::
level_enum
lvl
,
const
char
*
fmt
,
const
Args
&
...
args
)
inline
void
log
(
level
::
level_enum
lvl
,
string_view_t
fmt
,
const
Args
&
...
args
)
{
default_logger_raw
()
->
log
(
source_loc
{},
lvl
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
void
trace
(
const
char
*
fmt
,
const
Args
&
...
args
)
inline
void
trace
(
string_view_t
fmt
,
const
Args
&
...
args
)
{
default_logger_raw
()
->
trace
(
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
void
debug
(
const
char
*
fmt
,
const
Args
&
...
args
)
inline
void
debug
(
string_view_t
fmt
,
const
Args
&
...
args
)
{
default_logger_raw
()
->
debug
(
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
void
info
(
const
char
*
fmt
,
const
Args
&
...
args
)
inline
void
info
(
string_view_t
fmt
,
const
Args
&
...
args
)
{
default_logger_raw
()
->
info
(
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
void
warn
(
const
char
*
fmt
,
const
Args
&
...
args
)
inline
void
warn
(
string_view_t
fmt
,
const
Args
&
...
args
)
{
default_logger_raw
()
->
warn
(
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
void
error
(
const
char
*
fmt
,
const
Args
&
...
args
)
inline
void
error
(
string_view_t
fmt
,
const
Args
&
...
args
)
{
default_logger_raw
()
->
error
(
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
void
critical
(
const
char
*
fmt
,
const
Args
&
...
args
)
inline
void
critical
(
string_view_t
fmt
,
const
Args
&
...
args
)
{
default_logger_raw
()
->
critical
(
fmt
,
args
...);
}
...
...
@@ -206,43 +206,43 @@ inline void critical(const T &msg)
#ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT
template
<
typename
...
Args
>
inline
void
log
(
level
::
level_enum
lvl
,
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
inline
void
log
(
level
::
level_enum
lvl
,
wstring_view_t
fmt
,
const
Args
&
...
args
)
{
default_logger_raw
()
->
log
(
lvl
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
void
trace
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
inline
void
trace
(
wstring_view_t
fmt
,
const
Args
&
...
args
)
{
default_logger_raw
()
->
trace
(
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
void
debug
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
inline
void
debug
(
wstring_view_t
fmt
,
const
Args
&
...
args
)
{
default_logger_raw
()
->
debug
(
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
void
info
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
inline
void
info
(
wstring_view_t
fmt
,
const
Args
&
...
args
)
{
default_logger_raw
()
->
info
(
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
void
warn
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
inline
void
warn
(
wstring_view_t
fmt
,
const
Args
&
...
args
)
{
default_logger_raw
()
->
warn
(
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
void
error
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
inline
void
error
(
wstring_view_t
fmt
,
const
Args
&
...
args
)
{
default_logger_raw
()
->
error
(
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
void
critical
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
inline
void
critical
(
wstring_view_t
fmt
,
const
Args
&
...
args
)
{
default_logger_raw
()
->
critical
(
fmt
,
args
...);
}
...
...
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