mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-28 17:19:34 +08:00
clang-format
This commit is contained in:
@@ -33,17 +33,17 @@ TEST_CASE("daily_logger with dateonly calculator", "[daily_logger]")
|
||||
#ifdef SPDLOG_WCHAR_FILENAMES
|
||||
spdlog::memory_buf_t buf;
|
||||
spdlog::details::os::wstr_to_utf8buf(fmt::to_string(w), buf);
|
||||
#ifdef SPDLOG_USE_STD_FORMAT
|
||||
# ifdef SPDLOG_USE_STD_FORMAT
|
||||
auto &filename = buf;
|
||||
#else
|
||||
# else
|
||||
auto filename = fmt::to_string(buf);
|
||||
#endif
|
||||
# endif
|
||||
#else
|
||||
#ifdef SPDLOG_USE_STD_FORMAT
|
||||
# ifdef SPDLOG_USE_STD_FORMAT
|
||||
auto &filename = w;
|
||||
#else
|
||||
# else
|
||||
auto filename = fmt::to_string(w);
|
||||
#endif
|
||||
# endif
|
||||
#endif
|
||||
require_message_count(filename, 10);
|
||||
}
|
||||
@@ -53,8 +53,8 @@ struct custom_daily_file_name_calculator
|
||||
static spdlog::filename_t calc_filename(const spdlog::filename_t &basename, const tm &now_tm)
|
||||
{
|
||||
filename_memory_buf_t w;
|
||||
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);
|
||||
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);
|
||||
#ifdef SPDLOG_USE_STD_FORMAT
|
||||
return w;
|
||||
#else
|
||||
@@ -87,17 +87,17 @@ TEST_CASE("daily_logger with custom calculator", "[daily_logger]")
|
||||
#ifdef SPDLOG_WCHAR_FILENAMES
|
||||
spdlog::memory_buf_t buf;
|
||||
spdlog::details::os::wstr_to_utf8buf(fmt::to_string(w), buf);
|
||||
#ifdef SPDLOG_USE_STD_FORMAT
|
||||
# ifdef SPDLOG_USE_STD_FORMAT
|
||||
auto &filename = buf;
|
||||
#else
|
||||
# else
|
||||
auto filename = fmt::to_string(buf);
|
||||
#endif
|
||||
# endif
|
||||
#else
|
||||
#ifdef SPDLOG_USE_STD_FORMAT
|
||||
# ifdef SPDLOG_USE_STD_FORMAT
|
||||
auto &filename = w;
|
||||
#else
|
||||
# else
|
||||
auto filename = fmt::to_string(w);
|
||||
#endif
|
||||
# endif
|
||||
#endif
|
||||
require_message_count(filename, 10);
|
||||
}
|
||||
@@ -146,10 +146,10 @@ TEST_CASE("daily_file_sink::daily_filename_format_calculator", "[daily_file_sink
|
||||
{
|
||||
std::tm tm = spdlog::details::os::localtime();
|
||||
// example-YYYY-MM-DD.log
|
||||
auto filename =
|
||||
spdlog::sinks::daily_filename_format_calculator::calc_filename(SPDLOG_FILENAME_T("example-%Y-%m-%d.log"), tm);
|
||||
auto filename = spdlog::sinks::daily_filename_format_calculator::calc_filename(SPDLOG_FILENAME_T("example-%Y-%m-%d.log"), tm);
|
||||
|
||||
REQUIRE(filename == spdlog::fmt_lib::format(SPDLOG_FILENAME_T("example-{:04d}-{:02d}-{:02d}.log"), tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday));
|
||||
REQUIRE(filename ==
|
||||
spdlog::fmt_lib::format(SPDLOG_FILENAME_T("example-{:04d}-{:02d}-{:02d}.log"), tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday));
|
||||
}
|
||||
|
||||
/* Test removal of old files */
|
||||
|
@@ -5,7 +5,7 @@ using spdlog::memory_buf_t;
|
||||
|
||||
// log to str and return it
|
||||
template<typename... Args>
|
||||
static std::string log_to_str(const std::string &msg, const Args &...args)
|
||||
static std::string log_to_str(const std::string &msg, const Args &... args)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
auto oss_sink = std::make_shared<spdlog::sinks::ostream_sink_mt>(oss);
|
||||
|
Reference in New Issue
Block a user