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
2eb52cd0
Commit
2eb52cd0
authored
Aug 28, 2019
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unified usage of fmt::memory_buffer across the codebase
parent
f5492aed
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
formatter-bench.cpp
bench/formatter-bench.cpp
+1
-1
test_file_logging.cpp
tests/test_file_logging.cpp
+3
-3
No files found.
bench/formatter-bench.cpp
View file @
2eb52cd0
...
...
@@ -11,7 +11,7 @@
void
bench_formatter
(
benchmark
::
State
&
state
,
std
::
string
pattern
)
{
auto
formatter
=
spdlog
::
details
::
make_unique
<
spdlog
::
pattern_formatter
>
(
pattern
);
fmt
::
memory_buffer
dest
;
spdlog
::
memory_buf_t
dest
;
std
::
string
logger_name
=
"logger-name"
;
const
char
*
text
=
"Hello. This is some message with length of 80 "
;
...
...
tests/test_file_logging.cpp
View file @
2eb52cd0
...
...
@@ -102,7 +102,7 @@ TEST_CASE("daily_logger with dateonly calculator", "[daily_logger_dateonly]]")
// calculate filename (time based)
std
::
string
basename
=
"logs/daily_dateonly"
;
std
::
tm
tm
=
spdlog
::
details
::
os
::
localtime
();
fmt
::
memory_buffer
w
;
spdlog
::
memory_buf_t
w
;
fmt
::
format_to
(
w
,
"{}_{:04d}-{:02d}-{:02d}"
,
basename
,
tm
.
tm_year
+
1900
,
tm
.
tm_mon
+
1
,
tm
.
tm_mday
);
auto
logger
=
spdlog
::
create
<
sink_type
>
(
"logger"
,
basename
,
0
,
0
);
...
...
@@ -120,7 +120,7 @@ struct custom_daily_file_name_calculator
{
static
spdlog
::
filename_t
calc_filename
(
const
spdlog
::
filename_t
&
basename
,
const
tm
&
now_tm
)
{
fmt
::
memory_buffer
w
;
spdlog
::
memory_buf_t
w
;
fmt
::
format_to
(
w
,
"{}{:04d}{:02d}{:02d}"
,
basename
,
now_tm
.
tm_year
+
1900
,
now_tm
.
tm_mon
+
1
,
now_tm
.
tm_mday
);
return
fmt
::
to_string
(
w
);
}
...
...
@@ -134,7 +134,7 @@ TEST_CASE("daily_logger with custom calculator", "[daily_logger_custom]]")
// calculate filename (time based)
std
::
string
basename
=
"logs/daily_dateonly"
;
std
::
tm
tm
=
spdlog
::
details
::
os
::
localtime
();
fmt
::
memory_buffer
w
;
spdlog
::
memory_buf_t
w
;
fmt
::
format_to
(
w
,
"{}{:04d}{:02d}{:02d}"
,
basename
,
tm
.
tm_year
+
1900
,
tm
.
tm_mon
+
1
,
tm
.
tm_mday
);
auto
logger
=
spdlog
::
create
<
sink_type
>
(
"logger"
,
basename
,
0
,
0
);
...
...
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