From 74d3a59688a5ee73d10bec249b2eef96a58a8376 Mon Sep 17 00:00:00 2001 From: Gianluca Martino Date: Wed, 8 Mar 2023 12:23:49 +0100 Subject: [PATCH] Managing WCHAR=ON case. --- include/spdlog/spdlog.h | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/include/spdlog/spdlog.h b/include/spdlog/spdlog.h index cc78823a..e25d4338 100644 --- a/include/spdlog/spdlog.h +++ b/include/spdlog/spdlog.h @@ -175,16 +175,36 @@ struct info { default_logger_raw()->log(spdlog::source_loc{loc.file_name(), static_cast(loc.line()), loc.function_name()}, level::info, fmt, std::forward(args)...); } + +# ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT + info(wformat_string_t fmt, Args &&... args, const std::source_location &loc = std::source_location::current()) + { + default_logger_raw()->log(spdlog::source_loc{loc.file_name(), static_cast(loc.line()), loc.function_name()}, level::info, fmt, std::forward(args)...); + } +# endif }; template info(format_string_t fmt, Args &&... args) -> info; + +# ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT +template +info(wformat_string_t fmt, Args &&... args) -> info; +# endif #else template inline void info(format_string_t fmt, Args &&... args) { default_logger_raw()->info(fmt, std::forward(args)...); } + +# ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT +template +inline void info(wformat_string_t fmt, Args &&... args) +{ + default_logger_raw()->info(fmt, std::forward(args)...); +} +# endif #endif template @@ -242,12 +262,6 @@ inline void debug(wformat_string_t fmt, Args &&... args) default_logger_raw()->debug(fmt, std::forward(args)...); } -template -inline void info(wformat_string_t fmt, Args &&... args) -{ - default_logger_raw()->info(fmt, std::forward(args)...); -} - template inline void warn(wformat_string_t fmt, Args &&... args) {