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
2c0acf66
Commit
2c0acf66
authored
Nov 29, 2014
by
gabi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use cppformat in sinks
parent
8974d2de
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
13 deletions
+9
-13
include/spdlog/sinks/file_sinks.h
include/spdlog/sinks/file_sinks.h
+8
-11
include/spdlog/sinks/ostream_sink.h
include/spdlog/sinks/ostream_sink.h
+1
-2
No files found.
include/spdlog/sinks/file_sinks.h
View file @
2c0acf66
...
...
@@ -28,8 +28,7 @@
#include "base_sink.h"
#include "../details/null_mutex.h"
#include "../details/file_helper.h"
#include "../details/fast_oss.h"
#include "../details/format.h"
namespace
spdlog
...
...
@@ -100,12 +99,12 @@ protected:
private:
static
std
::
string
calc_filename
(
const
std
::
string
&
filename
,
std
::
size_t
index
,
const
std
::
string
&
extension
)
{
details
::
fast_oss
oss
;
fmt
::
MemoryWriter
w
;
if
(
index
)
oss
<<
filename
<<
"."
<<
index
<<
"."
<<
extension
;
w
.
write
(
"{}.{}.{}"
,
filename
,
index
,
extension
)
;
else
oss
<<
filename
<<
"."
<<
extension
;
return
oss
.
str
();
w
.
write
(
"{}.{}"
,
filename
,
extension
)
;
return
w
.
str
();
}
...
...
@@ -197,11 +196,9 @@ private:
static
std
::
string
calc_filename
(
const
std
::
string
&
basename
,
const
std
::
string
&
extension
)
{
std
::
tm
tm
=
spdlog
::
details
::
os
::
localtime
();
details
::
fast_oss
oss
;
oss
<<
basename
<<
'.'
;
oss
<<
tm
.
tm_year
+
1900
<<
'-'
<<
std
::
setw
(
2
)
<<
std
::
setfill
(
'0'
)
<<
tm
.
tm_mon
+
1
<<
'-'
<<
tm
.
tm_mday
;
oss
<<
'.'
<<
extension
;
return
oss
.
str
();
fmt
::
MemoryWriter
w
;
w
.
write
(
"{}.{:04d}-{:02d}-{:02d}.{}"
,
basename
,
tm
.
tm_year
+
1900
,
tm
.
tm_mon
+
1
,
tm
.
tm_mday
,
extension
);
return
w
.
str
();
}
std
::
string
_base_filename
;
...
...
include/spdlog/sinks/ostream_sink.h
View file @
2c0acf66
...
...
@@ -47,8 +47,7 @@ public:
protected:
virtual
void
_sink_it
(
const
details
::
log_msg
&
msg
)
override
{
auto
&
buf
=
msg
.
formatted
.
buf
();
_ostream
.
write
(
buf
.
data
(),
buf
.
size
());
_ostream
.
write
(
msg
.
formatted
.
data
(),
msg
.
formatted
.
size
());
}
std
::
ostream
&
_ostream
;
};
...
...
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