Replace fmt_helper::to_string by a macro

This commit is contained in:
Charles Milette
2022-04-26 23:25:35 -04:00
parent 37dd6bb159
commit cd4f6c1466
4 changed files with 12 additions and 13 deletions

View File

@@ -10,16 +10,16 @@ using filename_memory_buf_t = fmt::basic_memory_buffer<spdlog::filename_t::value
#endif
#ifdef SPDLOG_WCHAR_FILENAMES
std::string filename_buf_to_utf8string(filename_memory_buf_t &&w)
std::string filename_buf_to_utf8string(const filename_memory_buf_t &w)
{
spdlog::memory_buf_t buf;
spdlog::details::os::wstr_to_utf8buf(spdlog::wstring_view_t(w.data(), w.size()), buf);
return spdlog::details::fmt_helper::to_string(std::move(buf));
return SPDLOG_BUF_TO_STRING(buf);
}
#else
std::string filename_buf_to_utf8string(filename_memory_buf_t &&w)
std::string filename_buf_to_utf8string(const filename_memory_buf_t &w)
{
return spdlog::details::fmt_helper::to_string(std::move(w));
return SPDLOG_BUF_TO_STRING(w);
}
#endif
@@ -44,7 +44,7 @@ TEST_CASE("daily_logger with dateonly calculator", "[daily_logger]")
}
logger->flush();
require_message_count(filename_buf_to_utf8string(std::move(w)), 10);
require_message_count(filename_buf_to_utf8string(w), 10);
}
struct custom_daily_file_name_calculator
@@ -55,7 +55,7 @@ struct custom_daily_file_name_calculator
spdlog::fmt_lib::format_to(std::back_inserter(w), SPDLOG_FILENAME_T("{}{:04d}{:02d}{:02d}"), basename, now_tm.tm_year + 1900,
now_tm.tm_mon + 1, now_tm.tm_mday);
return spdlog::details::fmt_helper::to_string(std::move(w));
return SPDLOG_BUF_TO_STRING(w);
}
};
@@ -80,7 +80,7 @@ TEST_CASE("daily_logger with custom calculator", "[daily_logger]")
logger->flush();
require_message_count(filename_buf_to_utf8string(std::move(w)), 10);
require_message_count(filename_buf_to_utf8string(w), 10);
}
/*