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
7068c451
Commit
7068c451
authored
Nov 16, 2018
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed issue #908
parent
3bfcb046
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
21 deletions
+23
-21
include/spdlog/details/fmt_helper.h
include/spdlog/details/fmt_helper.h
+18
-17
include/spdlog/details/pattern_formatter.h
include/spdlog/details/pattern_formatter.h
+5
-4
No files found.
include/spdlog/details/fmt_helper.h
View file @
7068c451
...
@@ -43,20 +43,6 @@ inline void append_int(T n, fmt::basic_memory_buffer<char, Buffer_Size> &dest)
...
@@ -43,20 +43,6 @@ inline void append_int(T n, fmt::basic_memory_buffer<char, Buffer_Size> &dest)
}
}
template
<
typename
T
,
size_t
Buffer_Size
>
inline
void
append_uint
(
T
n
,
unsigned
int
width
,
fmt
::
basic_memory_buffer
<
char
,
Buffer_Size
>
&
dest
)
{
static_assert
(
std
::
is_unsigned
<
T
>::
value
,
"append_uint must get unsigned T"
);
auto
digits
=
fmt
::
internal
::
count_digits
(
n
);
if
(
width
>
digits
)
{
const
char
*
zeroes
=
"0000000000000000000"
;
dest
.
append
(
zeroes
,
zeroes
+
width
-
digits
);
}
append_int
(
n
,
dest
);
}
template
<
size_t
Buffer_Size
>
template
<
size_t
Buffer_Size
>
inline
void
pad2
(
int
n
,
fmt
::
basic_memory_buffer
<
char
,
Buffer_Size
>
&
dest
)
inline
void
pad2
(
int
n
,
fmt
::
basic_memory_buffer
<
char
,
Buffer_Size
>
&
dest
)
{
{
...
@@ -80,23 +66,38 @@ inline void pad2(int n, fmt::basic_memory_buffer<char, Buffer_Size> &dest)
...
@@ -80,23 +66,38 @@ inline void pad2(int n, fmt::basic_memory_buffer<char, Buffer_Size> &dest)
}
}
}
}
template
<
typename
T
,
size_t
Buffer_Size
>
inline
void
pad_uint
(
T
n
,
unsigned
int
width
,
fmt
::
basic_memory_buffer
<
char
,
Buffer_Size
>
&
dest
)
{
static_assert
(
std
::
is_unsigned
<
T
>::
value
,
"append_uint must get unsigned T"
);
auto
digits
=
fmt
::
internal
::
count_digits
(
n
);
if
(
width
>
digits
)
{
const
char
*
zeroes
=
"0000000000000000000"
;
dest
.
append
(
zeroes
,
zeroes
+
width
-
digits
);
}
append_int
(
n
,
dest
);
}
template
<
typename
T
,
size_t
Buffer_Size
>
template
<
typename
T
,
size_t
Buffer_Size
>
inline
void
pad3
(
T
n
,
fmt
::
basic_memory_buffer
<
char
,
Buffer_Size
>
&
dest
)
inline
void
pad3
(
T
n
,
fmt
::
basic_memory_buffer
<
char
,
Buffer_Size
>
&
dest
)
{
{
appen
d_uint
(
n
,
3
,
dest
);
pa
d_uint
(
n
,
3
,
dest
);
}
}
template
<
typename
T
,
size_t
Buffer_Size
>
template
<
typename
T
,
size_t
Buffer_Size
>
inline
void
pad6
(
T
n
,
fmt
::
basic_memory_buffer
<
char
,
Buffer_Size
>
&
dest
)
inline
void
pad6
(
T
n
,
fmt
::
basic_memory_buffer
<
char
,
Buffer_Size
>
&
dest
)
{
{
appen
d_uint
(
n
,
6
,
dest
);
pa
d_uint
(
n
,
6
,
dest
);
}
}
template
<
typename
T
,
size_t
Buffer_Size
>
template
<
typename
T
,
size_t
Buffer_Size
>
inline
void
pad9
(
T
n
,
fmt
::
basic_memory_buffer
<
char
,
Buffer_Size
>
&
dest
)
inline
void
pad9
(
T
n
,
fmt
::
basic_memory_buffer
<
char
,
Buffer_Size
>
&
dest
)
{
{
appen
d_uint
(
n
,
9
,
dest
);
pa
d_uint
(
n
,
9
,
dest
);
}
}
...
...
include/spdlog/details/pattern_formatter.h
View file @
7068c451
...
@@ -653,9 +653,9 @@ public:
...
@@ -653,9 +653,9 @@ public:
void
format
(
const
details
::
log_msg
&
msg
,
const
std
::
tm
&
,
fmt
::
memory_buffer
&
dest
)
override
void
format
(
const
details
::
log_msg
&
msg
,
const
std
::
tm
&
,
fmt
::
memory_buffer
&
dest
)
override
{
{
const
size_t
field_size
=
6
;
const
size_t
field_size
=
fmt
::
internal
::
count_digits
(
msg
.
thread_id
)
;
scoped_pad
p
(
field_size
,
padinfo_
,
dest
);
scoped_pad
p
(
field_size
,
padinfo_
,
dest
);
fmt_helper
::
pad6
(
msg
.
thread_id
,
dest
);
fmt_helper
::
append_int
(
msg
.
thread_id
,
dest
);
}
}
};
};
...
@@ -668,9 +668,10 @@ public:
...
@@ -668,9 +668,10 @@ public:
void
format
(
const
details
::
log_msg
&
,
const
std
::
tm
&
,
fmt
::
memory_buffer
&
dest
)
override
void
format
(
const
details
::
log_msg
&
,
const
std
::
tm
&
,
fmt
::
memory_buffer
&
dest
)
override
{
{
const
size_t
field_size
=
6
;
const
auto
pid
=
static_cast
<
uint32_t
>
(
details
::
os
::
pid
());
const
size_t
field_size
=
fmt
::
internal
::
count_digits
(
pid
);
scoped_pad
p
(
field_size
,
padinfo_
,
dest
);
scoped_pad
p
(
field_size
,
padinfo_
,
dest
);
fmt_helper
::
pad6
(
static_cast
<
size_t
>
(
details
::
os
::
pid
())
,
dest
);
fmt_helper
::
append_int
(
pid
,
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