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
3a21b765
Commit
3a21b765
authored
Sep 18, 2017
by
Gabi Melman
Committed by
GitHub
Sep 18, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #522 from jasonbeach/feat_add_epoch_formatter
add formatter for unix epoch time in seconds.
parents
a4e6d887
f7fabfb2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
include/spdlog/details/pattern_formatter_impl.h
include/spdlog/details/pattern_formatter_impl.h
+14
-0
No files found.
include/spdlog/details/pattern_formatter_impl.h
View file @
3a21b765
...
@@ -262,6 +262,16 @@ class F_formatter SPDLOG_FINAL:public flag_formatter
...
@@ -262,6 +262,16 @@ class F_formatter SPDLOG_FINAL:public flag_formatter
}
}
};
};
class
E_formatter
SPDLOG_FINAL
:
public
flag_formatter
{
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
)
override
{
auto
duration
=
msg
.
time
.
time_since_epoch
();
auto
seconds
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
seconds
>
(
duration
).
count
();
msg
.
formatted
<<
seconds
;
}
};
// AM/PM
// AM/PM
class
p_formatter
SPDLOG_FINAL
:
public
flag_formatter
class
p_formatter
SPDLOG_FINAL
:
public
flag_formatter
{
{
...
@@ -598,6 +608,10 @@ inline void spdlog::pattern_formatter::handle_flag(char flag)
...
@@ -598,6 +608,10 @@ inline void spdlog::pattern_formatter::handle_flag(char flag)
_formatters
.
push_back
(
std
::
unique_ptr
<
details
::
flag_formatter
>
(
new
details
::
F_formatter
()));
_formatters
.
push_back
(
std
::
unique_ptr
<
details
::
flag_formatter
>
(
new
details
::
F_formatter
()));
break
;
break
;
case
(
'E'
):
_formatters
.
push_back
(
std
::
unique_ptr
<
details
::
flag_formatter
>
(
new
details
::
E_formatter
()));
break
;
case
(
'p'
):
case
(
'p'
):
_formatters
.
push_back
(
std
::
unique_ptr
<
details
::
flag_formatter
>
(
new
details
::
p_formatter
()));
_formatters
.
push_back
(
std
::
unique_ptr
<
details
::
flag_formatter
>
(
new
details
::
p_formatter
()));
break
;
break
;
...
...
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