diff options
author | dkavolis <12998363+dkavolis@users.noreply.github.com> | 2021-07-22 18:19:48 +0300 |
---|---|---|
committer | dkavolis <12998363+dkavolis@users.noreply.github.com> | 2021-07-22 18:23:56 +0300 |
commit | d8f13cbd5bea70f20da22d984bdba93766998a0f (patch) | |
tree | 333b7ffc0dfeb8a0282a68bc1cf077dd6b259476 /include/spdlog/spdlog.h | |
parent | 0f39da5490959a9374b33ca11557ea61e203f071 (diff) |
replace FormatString template argument with fmt::basic_format_string
Diffstat (limited to 'include/spdlog/spdlog.h')
-rw-r--r-- | include/spdlog/spdlog.h | 82 |
1 files changed, 66 insertions, 16 deletions
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<spdlog::logger> default_logger); -template<typename FormatString, typename... Args> -inline void log(source_loc source, level::level_enum lvl, const FormatString &fmt, Args &&...args) +template<typename... Args> +inline void log(source_loc source, level::level_enum lvl, fmt::format_string<Args...> fmt, Args &&...args) { default_logger_raw()->log(source, lvl, fmt, std::forward<Args>(args)...); } -template<typename FormatString, typename... Args> -inline void log(level::level_enum lvl, const FormatString &fmt, Args &&...args) +template<typename... Args> +inline void log(level::level_enum lvl, fmt::format_string<Args...> fmt, Args &&...args) { default_logger_raw()->log(source_loc{}, lvl, fmt, std::forward<Args>(args)...); } -template<typename FormatString, typename... Args> -inline void trace(const FormatString &fmt, Args &&...args) +template<typename... Args> +inline void trace(fmt::format_string<Args...> fmt, Args &&...args) { default_logger_raw()->trace(fmt, std::forward<Args>(args)...); } -template<typename FormatString, typename... Args> -inline void debug(const FormatString &fmt, Args &&...args) +template<typename... Args> +inline void debug(fmt::format_string<Args...> fmt, Args &&...args) { default_logger_raw()->debug(fmt, std::forward<Args>(args)...); } -template<typename FormatString, typename... Args> -inline void info(const FormatString &fmt, Args &&...args) +template<typename... Args> +inline void info(fmt::format_string<Args...> fmt, Args &&...args) { default_logger_raw()->info(fmt, std::forward<Args>(args)...); } -template<typename FormatString, typename... Args> -inline void warn(const FormatString &fmt, Args &&...args) +template<typename... Args> +inline void warn(fmt::format_string<Args...> fmt, Args &&...args) { default_logger_raw()->warn(fmt, std::forward<Args>(args)...); } -template<typename FormatString, typename... Args> -inline void error(const FormatString &fmt, Args &&...args) +template<typename... Args> +inline void error(fmt::format_string<Args...> fmt, Args &&...args) { default_logger_raw()->error(fmt, std::forward<Args>(args)...); } -template<typename FormatString, typename... Args> -inline void critical(const FormatString &fmt, Args &&...args) +template<typename... Args> +inline void critical(fmt::format_string<Args...> fmt, Args &&...args) { default_logger_raw()->critical(fmt, std::forward<Args>(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<typename... Args> +inline void log(source_loc source, level::level_enum lvl, fmt::wformat_string<Args...> fmt, Args &&...args) +{ + default_logger_raw()->log(source, lvl, fmt, std::forward<Args>(args)...); +} + +template<typename... Args> +inline void log(level::level_enum lvl, fmt::wformat_string<Args...> fmt, Args &&...args) +{ + default_logger_raw()->log(source_loc{}, lvl, fmt, std::forward<Args>(args)...); +} + +template<typename... Args> +inline void trace(fmt::wformat_string<Args...> fmt, Args &&...args) +{ + default_logger_raw()->trace(fmt, std::forward<Args>(args)...); +} + +template<typename... Args> +inline void debug(fmt::wformat_string<Args...> fmt, Args &&...args) +{ + default_logger_raw()->debug(fmt, std::forward<Args>(args)...); +} + +template<typename... Args> +inline void info(fmt::wformat_string<Args...> fmt, Args &&...args) +{ + default_logger_raw()->info(fmt, std::forward<Args>(args)...); +} + +template<typename... Args> +inline void warn(fmt::wformat_string<Args...> fmt, Args &&...args) +{ + default_logger_raw()->warn(fmt, std::forward<Args>(args)...); +} + +template<typename... Args> +inline void error(fmt::wformat_string<Args...> fmt, Args &&...args) +{ + default_logger_raw()->error(fmt, std::forward<Args>(args)...); +} + +template<typename... Args> +inline void critical(fmt::wformat_string<Args...> fmt, Args &&...args) +{ + default_logger_raw()->critical(fmt, std::forward<Args>(args)...); +} +#endif + template<typename T> inline void trace(const T &msg) { |