Unnecessary backtrace begin/end logs (#2568)

* add empty getter function to tracer

* add unit test to check empty tracer

Co-authored-by: Gyorgy Katona <gykatona@logmein.com>
This commit is contained in:
György Katona
2022-12-09 09:25:17 +01:00
committed by GitHub
parent f0cd9d1530
commit 8512000f36
4 changed files with 21 additions and 1 deletions

View File

@@ -210,7 +210,7 @@ SPDLOG_INLINE void logger::flush_()
SPDLOG_INLINE void logger::dump_backtrace_()
{
using details::log_msg;
if (tracer_.enabled())
if (tracer_.enabled() && !tracer_.empty())
{
sink_it_(log_msg{name(), level::info, "****************** Backtrace Start ******************"});
tracer_.foreach_pop([this](const log_msg &msg) { this->sink_it_(msg); });