From b3ab35cf8eb2e5c1383cd0b4f9059a0ebd78e380 Mon Sep 17 00:00:00 2001 From: gabime Date: Fri, 15 Sep 2023 16:08:04 +0300 Subject: [PATCH] Fix issues with string view --- include/spdlog/logger.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/include/spdlog/logger.h b/include/spdlog/logger.h index 7fb2379f..e90acacd 100644 --- a/include/spdlog/logger.h +++ b/include/spdlog/logger.h @@ -114,10 +114,13 @@ public: sink_it_(details::log_msg(loc, name_, lvl, msg)); } } - template + template> void log(level::level_enum lvl, S msg) { - log(source_loc{}, lvl, msg); + if (should_log(lvl)) + { + sink_it_(details::log_msg(source_loc{}, name_, lvl, msg)); + } } // support for custom time @@ -167,7 +170,7 @@ public: log(fmt.loc, level::critical, fmt.fmt_string, std::forward(args)...); } - // log functions with no format string, just argument + // log functions with no format string, just string template> void trace(const S &msg, source_loc loc = source_loc::current()) { @@ -240,7 +243,7 @@ public: log(level::critical, fmt, std::forward(args)...); } - // log functions with no format string, just argument + // log functions with no format string, just string template> void trace(const S &msg) {