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
1344d44a
Commit
1344d44a
authored
Jul 21, 2021
by
dkavolis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check args on formatting
parent
61ed2a67
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
5 deletions
+7
-5
example/example.cpp
example/example.cpp
+1
-0
include/spdlog/fmt/bin_to_hex.h
include/spdlog/fmt/bin_to_hex.h
+1
-1
include/spdlog/logger.h
include/spdlog/logger.h
+5
-4
No files found.
example/example.cpp
View file @
1344d44a
...
...
@@ -23,6 +23,7 @@ void custom_flags_example();
#include "spdlog/spdlog.h"
#include "spdlog/cfg/env.h" // support for loading levels from the environment variable
#include "spdlog/fmt/ostr.h"
int
main
(
int
,
char
*
[])
{
...
...
include/spdlog/fmt/bin_to_hex.h
View file @
1344d44a
...
...
@@ -89,7 +89,7 @@ struct formatter<spdlog::details::dump_info<T>>
// parse the format string flags
template
<
typename
ParseContext
>
auto
parse
(
ParseContext
&
ctx
)
->
decltype
(
ctx
.
begin
())
FMT_CONSTEXPR
auto
parse
(
ParseContext
&
ctx
)
->
decltype
(
ctx
.
begin
())
{
auto
it
=
ctx
.
begin
();
while
(
it
!=
ctx
.
end
()
&&
*
it
!=
'}'
)
...
...
include/spdlog/logger.h
View file @
1344d44a
...
...
@@ -282,7 +282,7 @@ protected:
SPDLOG_TRY
{
memory_buf_t
buf
;
fmt
::
detail
::
vformat_to
(
buf
,
fmt
::
to_string_view
(
fmt
),
fmt
::
make_
format_args
(
args
...));
fmt
::
detail
::
vformat_to
(
buf
,
fmt
::
to_string_view
(
fmt
),
fmt
::
make_
args_checked
<
Args
...
>
(
fmt
,
args
...));
details
::
log_msg
log_msg
(
loc
,
name_
,
lvl
,
string_view_t
(
buf
.
data
(),
buf
.
size
()));
log_it_
(
log_msg
,
log_enabled
,
traceback_enabled
);
}
...
...
@@ -290,8 +290,9 @@ protected:
}
#ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT
template
<
typename
...
Args
>
void
log_
(
source_loc
loc
,
level
::
level_enum
lvl
,
const
wstring_view_t
&
fmt
,
Args
&&
...
args
)
template
<
typename
FormatString
,
typename
...
Args
,
typename
Char
=
fmt
::
char_t
<
FormatString
>,
typename
std
::
enable_if
<
std
::
is_same
<
Char
,
wchar_t
>::
value
,
Char
>::
type
*
=
nullptr
>
void
log_
(
source_loc
loc
,
level
::
level_enum
lvl
,
const
FormatString
&
fmt
,
Args
&&
...
args
)
{
bool
log_enabled
=
should_log
(
lvl
);
bool
traceback_enabled
=
tracer_
.
enabled
();
...
...
@@ -303,7 +304,7 @@ protected:
{
// format to wmemory_buffer and convert to utf8
fmt
::
wmemory_buffer
wbuf
;
fmt
::
format_to
(
std
::
back_inserter
(
wbuf
),
fmt
,
std
::
forward
<
Args
>
(
args
)...
);
fmt
::
detail
::
vformat_to
(
wbuf
,
fmt
::
wstring_view
(
fmt
),
fmt
::
make_args_checked
<
Args
...
>
(
fmt
,
args
...)
);
memory_buf_t
buf
;
details
::
os
::
wstr_to_utf8buf
(
wstring_view_t
(
wbuf
.
data
(),
wbuf
.
size
()),
buf
);
details
::
log_msg
log_msg
(
loc
,
name_
,
lvl
,
string_view_t
(
buf
.
data
(),
buf
.
size
()));
...
...
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