Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
spdlog
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
spdlog
Commits
fb1a3a3a
Commit
fb1a3a3a
authored
Nov 20, 2018
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Micro optimized some formatter flags
parent
52e27224
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
18 deletions
+50
-18
pattern_formatter.h
include/spdlog/details/pattern_formatter.h
+50
-18
No files found.
include/spdlog/details/pattern_formatter.h
View file @
fb1a3a3a
...
@@ -448,11 +448,17 @@ public:
...
@@ -448,11 +448,17 @@ 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
=
3
;
scoped_pad
p
(
field_size
,
padinfo_
,
dest
);
auto
millis
=
fmt_helper
::
time_fraction
<
std
::
chrono
::
milliseconds
>
(
msg
.
time
);
auto
millis
=
fmt_helper
::
time_fraction
<
std
::
chrono
::
milliseconds
>
(
msg
.
time
);
fmt_helper
::
pad3
(
static_cast
<
uint32_t
>
(
millis
.
count
()),
dest
);
if
(
padinfo_
.
width_
)
{
const
size_t
field_size
=
3
;
scoped_pad
p
(
field_size
,
padinfo_
,
dest
);
fmt_helper
::
pad3
(
static_cast
<
uint32_t
>
(
millis
.
count
()),
dest
);
}
else
{
fmt_helper
::
pad3
(
static_cast
<
uint32_t
>
(
millis
.
count
()),
dest
);
}
}
}
};
};
...
@@ -465,11 +471,17 @@ public:
...
@@ -465,11 +471,17 @@ 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
;
scoped_pad
p
(
field_size
,
padinfo_
,
dest
);
auto
micros
=
fmt_helper
::
time_fraction
<
std
::
chrono
::
microseconds
>
(
msg
.
time
);
auto
micros
=
fmt_helper
::
time_fraction
<
std
::
chrono
::
microseconds
>
(
msg
.
time
);
fmt_helper
::
pad6
(
static_cast
<
size_t
>
(
micros
.
count
()),
dest
);
if
(
padinfo_
.
width_
)
{
const
size_t
field_size
=
6
;
scoped_pad
p
(
field_size
,
padinfo_
,
dest
);
fmt_helper
::
pad6
(
static_cast
<
size_t
>
(
micros
.
count
()),
dest
);
}
else
{
fmt_helper
::
pad6
(
static_cast
<
size_t
>
(
micros
.
count
()),
dest
);
}
}
}
};
};
...
@@ -482,11 +494,17 @@ public:
...
@@ -482,11 +494,17 @@ 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
=
9
;
scoped_pad
p
(
field_size
,
padinfo_
,
dest
);
auto
ns
=
fmt_helper
::
time_fraction
<
std
::
chrono
::
nanoseconds
>
(
msg
.
time
);
auto
ns
=
fmt_helper
::
time_fraction
<
std
::
chrono
::
nanoseconds
>
(
msg
.
time
);
fmt_helper
::
pad9
(
static_cast
<
size_t
>
(
ns
.
count
()),
dest
);
if
(
padinfo_
.
width_
)
{
const
size_t
field_size
=
9
;
scoped_pad
p
(
field_size
,
padinfo_
,
dest
);
fmt_helper
::
pad9
(
static_cast
<
size_t
>
(
ns
.
count
()),
dest
);
}
else
{
fmt_helper
::
pad9
(
static_cast
<
size_t
>
(
ns
.
count
()),
dest
);
}
}
}
};
};
...
@@ -652,9 +670,16 @@ public:
...
@@ -652,9 +670,16 @@ 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
auto
field_size
=
fmt_helper
::
count_digits
(
msg
.
thread_id
);
if
(
padinfo_
.
width_
)
scoped_pad
p
(
field_size
,
padinfo_
,
dest
);
{
fmt_helper
::
append_int
(
msg
.
thread_id
,
dest
);
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
);
}
else
{
fmt_helper
::
append_int
(
msg
.
thread_id
,
dest
);
}
}
}
};
};
...
@@ -668,9 +693,16 @@ public:
...
@@ -668,9 +693,16 @@ 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
auto
pid
=
static_cast
<
uint32_t
>
(
details
::
os
::
pid
());
const
auto
pid
=
static_cast
<
uint32_t
>
(
details
::
os
::
pid
());
const
size_t
field_size
=
fmt
::
internal
::
count_digits
(
pid
);
if
(
padinfo_
.
width_
)
scoped_pad
p
(
field_size
,
padinfo_
,
dest
);
{
fmt_helper
::
append_int
(
pid
,
dest
);
const
size_t
field_size
=
fmt
::
internal
::
count_digits
(
pid
);
scoped_pad
p
(
field_size
,
padinfo_
,
dest
);
fmt_helper
::
append_int
(
pid
,
dest
);
}
else
{
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