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
c7f42d1a
Unverified
Commit
c7f42d1a
authored
Nov 19, 2018
by
Gabi Melman
Committed by
GitHub
Nov 19, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #917 from DanielChabrowski/fix-xcode-ci
Fix osx build
parents
e601ebe1
6232ec78
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
12 deletions
+13
-12
include/spdlog/details/fmt_helper.h
include/spdlog/details/fmt_helper.h
+12
-10
include/spdlog/details/pattern_formatter.h
include/spdlog/details/pattern_formatter.h
+1
-2
No files found.
include/spdlog/details/fmt_helper.h
View file @
c7f42d1a
...
...
@@ -18,6 +18,7 @@ inline spdlog::string_view_t to_string_view(const fmt::basic_memory_buffer<char,
{
return
spdlog
::
string_view_t
(
buf
.
data
(),
buf
.
size
());
}
template
<
size_t
Buffer_Size1
,
size_t
Buffer_Size2
>
inline
void
append_buf
(
const
fmt
::
basic_memory_buffer
<
char
,
Buffer_Size1
>
&
buf
,
fmt
::
basic_memory_buffer
<
char
,
Buffer_Size2
>
&
dest
)
{
...
...
@@ -42,6 +43,12 @@ inline void append_int(T n, fmt::basic_memory_buffer<char, Buffer_Size> &dest)
dest
.
append
(
i
.
data
(),
i
.
data
()
+
i
.
size
());
}
template
<
typename
T
>
inline
unsigned
count_digits
(
T
n
)
{
using
count_type
=
std
::
conditional
<
(
sizeof
(
T
)
>
sizeof
(
std
::
uint32_t
)),
std
::
uint64_t
,
std
::
uint32_t
>::
type
;
return
fmt
::
internal
::
count_digits
(
static_cast
<
count_type
>
(
n
));
}
template
<
size_t
Buffer_Size
>
inline
void
pad2
(
int
n
,
fmt
::
basic_memory_buffer
<
char
,
Buffer_Size
>
&
dest
)
...
...
@@ -66,17 +73,15 @@ 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
)
auto
digits
=
count_digits
(
n
);
if
(
width
>
digits
)
{
const
char
*
zeroes
=
"0000000000000000000"
;
dest
.
append
(
zeroes
,
zeroes
+
width
-
digits
);
const
char
*
zeroes
=
"0000000000000000000"
;
dest
.
append
(
zeroes
,
zeroes
+
width
-
digits
);
}
append_int
(
n
,
dest
);
}
...
...
@@ -87,7 +92,6 @@ inline void pad3(T n, fmt::basic_memory_buffer<char, Buffer_Size> &dest)
pad_uint
(
n
,
3
,
dest
);
}
template
<
typename
T
,
size_t
Buffer_Size
>
inline
void
pad6
(
T
n
,
fmt
::
basic_memory_buffer
<
char
,
Buffer_Size
>
&
dest
)
{
...
...
@@ -100,8 +104,6 @@ inline void pad9(T n, fmt::basic_memory_buffer<char, Buffer_Size> &dest)
pad_uint
(
n
,
9
,
dest
);
}
// return fraction of a second of the given time_point.
// e.g.
// fraction<std::milliseconds>(tp) -> will return the millis part of the second
...
...
include/spdlog/details/pattern_formatter.h
View file @
c7f42d1a
...
...
@@ -487,7 +487,6 @@ public:
auto
ns
=
fmt_helper
::
time_fraction
<
std
::
chrono
::
nanoseconds
>
(
msg
.
time
);
fmt_helper
::
pad9
(
static_cast
<
size_t
>
(
ns
.
count
()),
dest
);
}
};
...
...
@@ -653,7 +652,7 @@ public:
void
format
(
const
details
::
log_msg
&
msg
,
const
std
::
tm
&
,
fmt
::
memory_buffer
&
dest
)
override
{
const
size_t
field_size
=
fmt
::
internal
::
count_digits
(
msg
.
thread_id
);
const
auto
field_size
=
fmt_helper
::
count_digits
(
msg
.
thread_id
);
scoped_pad
p
(
field_size
,
padinfo_
,
dest
);
fmt_helper
::
append_int
(
msg
.
thread_id
,
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