mirror of
https://github.com/gabime/spdlog.git
synced 2024-11-15 16:35:45 +08:00
some cleanup in logger
This commit is contained in:
parent
f63df65245
commit
0258c47774
@ -38,6 +38,7 @@ void prepare_logdir()
|
||||
|
||||
void bench_c_string(benchmark::State &state, std::shared_ptr<spdlog::logger> logger)
|
||||
{
|
||||
logger->enable_backtrace(64);
|
||||
const char *msg = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum pharetra metus cursus "
|
||||
"lacus placerat congue. Nulla egestas, mauris a tincidunt tempus, enim lectus volutpat mi, eu consequat sem "
|
||||
"libero nec massa. In dapibus ipsum a diam rhoncus gravida. Etiam non dapibus eros. Donec fringilla dui sed "
|
||||
@ -52,6 +53,7 @@ void bench_c_string(benchmark::State &state, std::shared_ptr<spdlog::logger> log
|
||||
|
||||
void bench_logger(benchmark::State &state, std::shared_ptr<spdlog::logger> logger)
|
||||
{
|
||||
logger->enable_backtrace(64);
|
||||
int i = 0;
|
||||
for (auto _ : state)
|
||||
{
|
||||
@ -61,6 +63,7 @@ void bench_logger(benchmark::State &state, std::shared_ptr<spdlog::logger> logge
|
||||
|
||||
void bench_disabled_macro(benchmark::State &state, std::shared_ptr<spdlog::logger> logger)
|
||||
{
|
||||
logger->enable_backtrace(64);
|
||||
int i = 0;
|
||||
benchmark::DoNotOptimize(i); // prevent unused warnings
|
||||
benchmark::DoNotOptimize(logger); // prevent unused warnings
|
||||
|
@ -138,7 +138,7 @@ SPDLOG_INLINE void logger::enable_backtrace(size_t n_messages)
|
||||
{
|
||||
if (!backtrace_sink_)
|
||||
{
|
||||
backtrace_sink_ = std::make_shared<sinks::backtrace_sink_mt>((std::move(sinks_), level(), n_messages));
|
||||
backtrace_sink_ = std::make_shared<sinks::backtrace_sink_mt>(std::move(sinks_), level(), n_messages);
|
||||
sinks().push_back(backtrace_sink_);
|
||||
level_.store(level::trace); // pass all messages to the backtrace sink.
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user