Switch to vformat_to

Drive-by: reduce the amount of occurences of #ifdef SPDLOG_USE_STD_FORMAT
This commit is contained in:
Charles Milette
2022-04-21 21:46:58 -04:00
parent b3ce5ed379
commit ebeb3707b1
10 changed files with 66 additions and 166 deletions

View File

@@ -23,6 +23,20 @@ inline spdlog::string_view_t to_string_view(const memory_buf_t &buf) SPDLOG_NOEX
return spdlog::string_view_t{buf.data(), buf.size()};
}
#ifdef SPDLOG_USE_STD_FORMAT
template<typename T>
std::basic_string<T> to_string(const std::basic_string<T> &buf)
{
return buf;
}
#else
template<typename T, size_t Size>
std::basic_string<T> to_string(const fmt::basic_memory_buffer<T, Size> &buf)
{
return fmt::to_string(buf);
}
#endif
inline void append_string_view(spdlog::string_view_t view, memory_buf_t &dest)
{
auto *buf_ptr = view.data();

View File

@@ -388,11 +388,7 @@ SPDLOG_INLINE std::string filename_to_str(const filename_t &filename)
{
memory_buf_t buf;
wstr_to_utf8buf(filename, buf);
# ifdef SPDLOG_USE_STD_FORMAT
return buf;
# else
return fmt::to_string(buf);
# endif
return fmt_helper::to_string(buf);
}
#else
SPDLOG_INLINE std::string filename_to_str(const filename_t &filename)