From da3d81a80081615586b9aee625f2eee569f7b6ea Mon Sep 17 00:00:00 2001 From: Charles Milette Date: Fri, 11 Nov 2022 21:16:36 -0500 Subject: [PATCH] Bring back fmt optimization --- include/spdlog/logger.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/spdlog/logger.h b/include/spdlog/logger.h index 094ee961..eb4be7a8 100644 --- a/include/spdlog/logger.h +++ b/include/spdlog/logger.h @@ -369,8 +369,11 @@ protected: SPDLOG_TRY { memory_buf_t buf; +#ifdef SPDLOG_USE_STD_FORMAT fmt_lib::vformat_to(std::back_inserter(buf), fmt, fmt_lib::make_format_args(std::forward(args)...)); - +#else + fmt::vformat_to(fmt::appender(buf), fmt, fmt::make_format_args(std::forward(args)...)); +#endif details::log_msg log_msg(loc, name_, lvl, string_view_t(buf.data(), buf.size())); log_it_(log_msg, log_enabled, traceback_enabled); } @@ -391,8 +394,12 @@ protected: { // format to wmemory_buffer and convert to utf8 wmemory_buf_t wbuf; +# ifdef SPDLOG_USE_STD_FORMAT fmt_lib::vformat_to( std::back_inserter(wbuf), fmt, fmt_lib::make_format_args(std::forward(args)...)); +# else + fmt::vformat_to(fmt::appender(wbuf), fmt, fmt::make_format_args(std::forward(args)...)); +# endif memory_buf_t buf; details::os::wstr_to_utf8buf(wstring_view_t(wbuf.data(), wbuf.size()), buf);