mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-16 09:47:56 +00:00
Compare commits
2 Commits
63ab8e6341
...
357b6c9d8c
Author | SHA1 | Date | |
---|---|---|---|
|
357b6c9d8c | ||
|
b0c4794305 |
@ -39,6 +39,16 @@ void bench_logger(benchmark::State &state, std::shared_ptr<spdlog::logger> logge
|
||||
}
|
||||
}
|
||||
|
||||
void bench_logger_fmt_string(benchmark::State &state, std::shared_ptr<spdlog::logger> logger)
|
||||
{
|
||||
int i = 0;
|
||||
for (auto _ : state)
|
||||
{
|
||||
logger->info(FMT_STRING("Hello logger: msg number {}..............."), ++i);
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
void bench_disabled_macro(benchmark::State &state, std::shared_ptr<spdlog::logger> logger)
|
||||
{
|
||||
int i = 0;
|
||||
@ -88,6 +98,7 @@ int main(int argc, char *argv[])
|
||||
auto null_logger_st = std::make_shared<spdlog::logger>("bench", std::make_shared<null_sink_st>());
|
||||
benchmark::RegisterBenchmark("null_sink_st (500_bytes c_str)", bench_c_string, std::move(null_logger_st));
|
||||
benchmark::RegisterBenchmark("null_sink_st", bench_logger, null_logger_st);
|
||||
benchmark::RegisterBenchmark("null_sink_fmt_string", bench_logger_fmt_string, null_logger_st);
|
||||
// with backtrace of 64
|
||||
auto tracing_null_logger_st = std::make_shared<spdlog::logger>("bench", std::make_shared<null_sink_st>());
|
||||
tracing_null_logger_st->enable_backtrace(64);
|
||||
|
@ -74,7 +74,8 @@ public:
|
||||
void swap(spdlog::logger &other) SPDLOG_NOEXCEPT;
|
||||
|
||||
// FormatString is a type derived from fmt::compile_string
|
||||
template<typename FormatString, typename std::enable_if<fmt::is_compile_string<FormatString>::value, int>::type = 0, typename... Args>
|
||||
template<typename FormatString, typename std::enable_if<fmt::is_compile_string<FormatString>::value, int>::type * = nullptr,
|
||||
typename... Args>
|
||||
void log(source_loc loc, level::level_enum lvl, const FormatString &fmt, const Args &... args)
|
||||
{
|
||||
log_(loc, lvl, fmt, args...);
|
||||
|
Loading…
Reference in New Issue
Block a user