mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-29 01:29:35 +08:00
backward compatibility with fmt version < 8
This commit is contained in:
@@ -35,8 +35,14 @@
|
||||
|
||||
#include <spdlog/fmt/fmt.h>
|
||||
|
||||
#if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT)
|
||||
# include <spdlog/fmt/xchar.h>
|
||||
// backward compatibility with fmt versions older than 8
|
||||
#if FMT_VERSION >= 80000
|
||||
# define SPDLOG_FMT_RUNTIME(format_string) fmt::runtime(format_string)
|
||||
# if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT)
|
||||
# include <spdlog/fmt/xchar.h>
|
||||
# endif
|
||||
#else
|
||||
# define SPDLOG_FMT_RUNTIME(format_string) format_string
|
||||
#endif
|
||||
|
||||
// visual studio upto 2013 does not support noexcept nor constexpr
|
||||
|
@@ -341,7 +341,7 @@ protected:
|
||||
SPDLOG_TRY
|
||||
{
|
||||
memory_buf_t buf;
|
||||
fmt::format_to(std::back_inserter(buf), fmt::runtime(fmt), std::forward<Args>(args)...);
|
||||
fmt::format_to(std::back_inserter(buf), SPDLOG_FMT_RUNTIME(fmt), std::forward<Args>(args)...);
|
||||
details::log_msg log_msg(loc, name_, lvl, string_view_t(buf.data(), buf.size()));
|
||||
log_it_(log_msg, log_enabled, traceback_enabled);
|
||||
}
|
||||
|
@@ -53,7 +53,7 @@ struct daily_filename_format_calculator
|
||||
#if defined(_MSC_VER) && defined(SPDLOG_WCHAR_FILENAMES) // for some reason msvc doesnt allow fmt::runtime(..) with wchar here
|
||||
return fmt::format(fmt_filename, now_tm);
|
||||
#else
|
||||
return fmt::format(fmt::runtime(fmt_filename), now_tm);
|
||||
return fmt::format(SPDLOG_FMT_RUNTIME(fmt_filename), now_tm);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user