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
0f83b33d
Commit
0f83b33d
authored
Jul 10, 2021
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
backward compatibility with fmt version < 8
parent
b83106be
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
11 deletions
+16
-11
bench/async_bench.cpp
bench/async_bench.cpp
+6
-7
include/spdlog/common.h
include/spdlog/common.h
+8
-2
include/spdlog/logger.h
include/spdlog/logger.h
+1
-1
include/spdlog/sinks/daily_file_sink.h
include/spdlog/sinks/daily_file_sink.h
+1
-1
No files found.
bench/async_bench.cpp
View file @
0f83b33d
...
...
@@ -103,12 +103,11 @@ int main(int argc, char *argv[])
auto
slot_size
=
sizeof
(
spdlog
::
details
::
async_msg
);
spdlog
::
info
(
"-------------------------------------------------"
);
spdlog
::
info
(
fmt
::
format
(
std
::
locale
(
"en_US.UTF-8"
),
"Messages : {:L}"
,
howmany
));
spdlog
::
info
(
fmt
::
format
(
std
::
locale
(
"en_US.UTF-8"
),
"Threads : {:L}"
,
threads
));
spdlog
::
info
(
fmt
::
format
(
std
::
locale
(
"en_US.UTF-8"
),
"Queue : {:L} slots"
,
queue_size
));
spdlog
::
info
(
fmt
::
format
(
std
::
locale
(
"en_US.UTF-8"
),
"Queue memory : {:L} x {:L} = {:L} KB "
,
queue_size
,
slot_size
,
(
queue_size
*
slot_size
)
/
1024
));
spdlog
::
info
(
fmt
::
format
(
std
::
locale
(
"en_US.UTF-8"
),
"Total iters : {:L}"
,
iters
));
spdlog
::
info
(
"Messages : {:L}"
,
howmany
);
spdlog
::
info
(
"Threads : {:L}"
,
threads
);
spdlog
::
info
(
"Queue : {:L} slots"
,
queue_size
);
spdlog
::
info
(
"Queue memory : {:L} x {:L} = {:L} KB "
,
queue_size
,
slot_size
,
(
queue_size
*
slot_size
)
/
1024
);
spdlog
::
info
(
"Total iters : {:L}"
,
iters
);
spdlog
::
info
(
"-------------------------------------------------"
);
const
char
*
filename
=
"logs/basic_async.log"
;
...
...
@@ -181,5 +180,5 @@ void bench_mt(int howmany, std::shared_ptr<spdlog::logger> logger, int thread_co
auto
delta
=
high_resolution_clock
::
now
()
-
start
;
auto
delta_d
=
duration_cast
<
duration
<
double
>>
(
delta
).
count
();
spdlog
::
info
(
fmt
::
format
(
std
::
locale
(
"en_US.UTF-8"
),
"Elapsed: {} secs
\t
{:L}/sec"
,
delta_d
,
int
(
howmany
/
delta_d
)
));
spdlog
::
info
(
"Elapsed: {} secs
\t
{:L}/sec"
,
delta_d
,
int
(
howmany
/
delta_d
));
}
include/spdlog/common.h
View file @
0f83b33d
...
...
@@ -35,8 +35,14 @@
#include <spdlog/fmt/fmt.h>
#if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT)
// backward compatibility with fmt versions older than 8
#if FMT_VERSION >= 80000
# define SPDLOG_FMT_RUNTIME(format_string) fmt::runtime(format_string)
# if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT)
# include <spdlog/fmt/xchar.h>
# endif
#else
# define SPDLOG_FMT_RUNTIME(format_string) format_string
#endif
// visual studio upto 2013 does not support noexcept nor constexpr
...
...
include/spdlog/logger.h
View file @
0f83b33d
...
...
@@ -341,7 +341,7 @@ protected:
SPDLOG_TRY
{
memory_buf_t
buf
;
fmt
::
format_to
(
std
::
back_inserter
(
buf
),
fmt
::
runtime
(
fmt
),
std
::
forward
<
Args
>
(
args
)...);
fmt
::
format_to
(
std
::
back_inserter
(
buf
),
SPDLOG_FMT_RUNTIME
(
fmt
),
std
::
forward
<
Args
>
(
args
)...);
details
::
log_msg
log_msg
(
loc
,
name_
,
lvl
,
string_view_t
(
buf
.
data
(),
buf
.
size
()));
log_it_
(
log_msg
,
log_enabled
,
traceback_enabled
);
}
...
...
include/spdlog/sinks/daily_file_sink.h
View file @
0f83b33d
...
...
@@ -53,7 +53,7 @@ struct daily_filename_format_calculator
#if defined(_MSC_VER) && defined(SPDLOG_WCHAR_FILENAMES) // for some reason msvc doesnt allow fmt::runtime(..) with wchar here
return
fmt
::
format
(
fmt_filename
,
now_tm
);
#else
return
fmt
::
format
(
fmt
::
runtime
(
fmt_filename
),
now_tm
);
return
fmt
::
format
(
SPDLOG_FMT_RUNTIME
(
fmt_filename
),
now_tm
);
#endif
}
};
...
...
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