diff --git a/include/spdlog/logger.h b/include/spdlog/logger.h index a6dea987..b82ba202 100644 --- a/include/spdlog/logger.h +++ b/include/spdlog/logger.h @@ -80,7 +80,11 @@ public: template void log(source_loc loc, level::level_enum lvl, format_string_t fmt, Args &&...args) { - log_with_format_(loc, lvl, details::to_string_view(fmt), std::forward(args)...); + if (should_log(lvl)) + { + log_with_format_(loc, lvl, details::to_string_view(fmt), std::forward(args)...); + } + } template @@ -247,10 +251,7 @@ protected: template void log_with_format_(source_loc loc, level::level_enum lvl, string_view_t fmt, Args &&...args) { - if (!should_log(lvl)) - { - return; - } + assert(should_log(lvl)); SPDLOG_TRY { memory_buf_t buf;