From d8f13cbd5bea70f20da22d984bdba93766998a0f Mon Sep 17 00:00:00 2001 From: dkavolis <12998363+dkavolis@users.noreply.github.com> Date: Thu, 22 Jul 2021 16:19:48 +0100 Subject: replace FormatString template argument with fmt::basic_format_string --- include/spdlog/spdlog.h | 82 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 66 insertions(+), 16 deletions(-) (limited to 'include/spdlog/spdlog.h') diff --git a/include/spdlog/spdlog.h b/include/spdlog/spdlog.h index 41c6bbb8..812896da 100644 --- a/include/spdlog/spdlog.h +++ b/include/spdlog/spdlog.h @@ -127,50 +127,50 @@ SPDLOG_API spdlog::logger *default_logger_raw(); SPDLOG_API void set_default_logger(std::shared_ptr default_logger); -template -inline void log(source_loc source, level::level_enum lvl, const FormatString &fmt, Args &&...args) +template +inline void log(source_loc source, level::level_enum lvl, fmt::format_string fmt, Args &&...args) { default_logger_raw()->log(source, lvl, fmt, std::forward(args)...); } -template -inline void log(level::level_enum lvl, const FormatString &fmt, Args &&...args) +template +inline void log(level::level_enum lvl, fmt::format_string fmt, Args &&...args) { default_logger_raw()->log(source_loc{}, lvl, fmt, std::forward(args)...); } -template -inline void trace(const FormatString &fmt, Args &&...args) +template +inline void trace(fmt::format_string fmt, Args &&...args) { default_logger_raw()->trace(fmt, std::forward(args)...); } -template -inline void debug(const FormatString &fmt, Args &&...args) +template +inline void debug(fmt::format_string fmt, Args &&...args) { default_logger_raw()->debug(fmt, std::forward(args)...); } -template -inline void info(const FormatString &fmt, Args &&...args) +template +inline void info(fmt::format_string fmt, Args &&...args) { default_logger_raw()->info(fmt, std::forward(args)...); } -template -inline void warn(const FormatString &fmt, Args &&...args) +template +inline void warn(fmt::format_string fmt, Args &&...args) { default_logger_raw()->warn(fmt, std::forward(args)...); } -template -inline void error(const FormatString &fmt, Args &&...args) +template +inline void error(fmt::format_string fmt, Args &&...args) { default_logger_raw()->error(fmt, std::forward(args)...); } -template -inline void critical(const FormatString &fmt, Args &&...args) +template +inline void critical(fmt::format_string fmt, Args &&...args) { default_logger_raw()->critical(fmt, std::forward(args)...); } @@ -187,6 +187,56 @@ inline void log(level::level_enum lvl, const T &msg) default_logger_raw()->log(lvl, msg); } +#ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT +template +inline void log(source_loc source, level::level_enum lvl, fmt::wformat_string fmt, Args &&...args) +{ + default_logger_raw()->log(source, lvl, fmt, std::forward(args)...); +} + +template +inline void log(level::level_enum lvl, fmt::wformat_string fmt, Args &&...args) +{ + default_logger_raw()->log(source_loc{}, lvl, fmt, std::forward(args)...); +} + +template +inline void trace(fmt::wformat_string fmt, Args &&...args) +{ + default_logger_raw()->trace(fmt, std::forward(args)...); +} + +template +inline void debug(fmt::wformat_string fmt, Args &&...args) +{ + default_logger_raw()->debug(fmt, std::forward(args)...); +} + +template +inline void info(fmt::wformat_string fmt, Args &&...args) +{ + default_logger_raw()->info(fmt, std::forward(args)...); +} + +template +inline void warn(fmt::wformat_string fmt, Args &&...args) +{ + default_logger_raw()->warn(fmt, std::forward(args)...); +} + +template +inline void error(fmt::wformat_string fmt, Args &&...args) +{ + default_logger_raw()->error(fmt, std::forward(args)...); +} + +template +inline void critical(fmt::wformat_string fmt, Args &&...args) +{ + default_logger_raw()->critical(fmt, std::forward(args)...); +} +#endif + template inline void trace(const T &msg) { -- cgit v1.2.3