From 0df9164e7c487208bdef85edd08bb4ad12b3cd90 Mon Sep 17 00:00:00 2001 From: gabime Date: Wed, 7 Aug 2019 01:29:59 +0300 Subject: [PATCH] Fix #1176 --- include/spdlog/logger.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/include/spdlog/logger.h b/include/spdlog/logger.h index 63287d43..7d91e02c 100644 --- a/include/spdlog/logger.h +++ b/include/spdlog/logger.h @@ -214,13 +214,8 @@ public: #error SPDLOG_WCHAR_TO_UTF8_SUPPORT only supported on windows #else template - void log(source_loc source, level::level_enum lvl, wstring_view_t fmt, const Args &... args) + void force_log(source_loc loc, level::level_enum lvl, string_view_t fmt, const Args &... args) { - if (!should_log(lvl)) - { - return; - } - try { // format to wmemory_buffer and convert to utf8 @@ -236,6 +231,15 @@ public: SPDLOG_LOGGER_CATCH() } + template + void log(source_loc source, level::level_enum lvl, wstring_view_t fmt, const Args &... args) + { + if (should_log(lvl)) + { + force_log(loc, lvl, fmt, args...); + } + } + template void log(level::level_enum lvl, wstring_view_t fmt, const Args &... args) {