Skip to content

Commit

Permalink
Use std::vformat
Browse files Browse the repository at this point in the history
  • Loading branch information
gabime committed Sep 17, 2023
1 parent 6a0a391 commit f888488
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions include/spdlog/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,13 +321,14 @@ class SPDLOG_API logger
assert(should_log(lvl));
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(args...));
#else
fmt::vformat_to(fmt::appender(buf), fmt, fmt::make_format_args(args...));
#endif
auto formatted = std::vformat(fmt, std::make_format_args(args...));
sink_it_(details::log_msg(loc, name_, lvl, formatted));
#else // use {fmt} lib
memory_buf_t buf;
fmt::vformat_to(std::back_inserter(buf), fmt, fmt::make_format_args(args...));
sink_it_(details::log_msg(loc, name_, lvl, string_view_t(buf.data(), buf.size())));
#endif
}
SPDLOG_LOGGER_CATCH(loc)
}
Expand Down

0 comments on commit f888488

Please sign in to comment.