diff --git a/include/spdlog/common.h b/include/spdlog/common.h index 8456ca79..1710aa46 100644 --- a/include/spdlog/common.h +++ b/include/spdlog/common.h @@ -63,13 +63,11 @@ #if !defined(SPDLOG_USE_STD_FORMAT) && FMT_VERSION >= 80000 // backward compatibility with fmt versions older than 8 # define SPDLOG_FMT_RUNTIME(format_string) fmt::runtime(format_string) -# define SPDLOG_FMT_STRING(format_string) FMT_STRING(format_string) # if defined(SPDLOG_WCHAR_FILENAMES) # include # endif #else # define SPDLOG_FMT_RUNTIME(format_string) format_string -# define SPDLOG_FMT_STRING(format_string) format_string #endif #ifndef SPDLOG_FUNCTION diff --git a/include/spdlog/details/fmt_helper.h b/include/spdlog/details/fmt_helper.h index 663fbf9b..1a89d700 100644 --- a/include/spdlog/details/fmt_helper.h +++ b/include/spdlog/details/fmt_helper.h @@ -102,7 +102,7 @@ inline void pad2(int n, memory_buf_t &dest) } else // unlikely, but just in case, let fmt deal with it { - fmt_lib::format_to(std::back_inserter(dest), SPDLOG_FMT_STRING("{:02}"), n); + fmt_lib::format_to(std::back_inserter(dest), "{:02}", n); } } diff --git a/include/spdlog/fmt/bin_to_hex.h b/include/spdlog/fmt/bin_to_hex.h index 5da6e018..4f3dad74 100644 --- a/include/spdlog/fmt/bin_to_hex.h +++ b/include/spdlog/fmt/bin_to_hex.h @@ -241,7 +241,7 @@ struct formatter, char> if (put_positions) { - spdlog::fmt_lib::format_to(inserter, SPDLOG_FMT_STRING("{:04X}: "), pos); + spdlog::fmt_lib::format_to(inserter, "{:04X}: ", pos); } } }; diff --git a/include/spdlog/logger.h b/include/spdlog/logger.h index b4a70824..528f46ab 100644 --- a/include/spdlog/logger.h +++ b/include/spdlog/logger.h @@ -25,9 +25,9 @@ # define SPDLOG_LOGGER_CATCH(location) \ catch (const std::exception &ex) \ { \ - if (location.filename) \ + if (!location.empty()) \ { \ - err_handler_(fmt_lib::format(SPDLOG_FMT_STRING("{} [{}({})]"), ex.what(), location.filename, location.line)); \ + err_handler_(fmt_lib::format("{} [{}({})]", ex.what(), location.filename, location.line)); \ } \ else \ { \ diff --git a/include/spdlog/sinks/daily_file_sink.h b/include/spdlog/sinks/daily_file_sink.h index 0770380c..7650ec44 100644 --- a/include/spdlog/sinks/daily_file_sink.h +++ b/include/spdlog/sinks/daily_file_sink.h @@ -33,7 +33,7 @@ struct daily_filename_calculator { filename_t basename, ext; std::tie(basename, ext) = details::file_helper::split_by_extension(filename); - return fmt_lib::format(SPDLOG_FMT_STRING(SPDLOG_FILENAME_T("{}_{:04d}-{:02d}-{:02d}{}")), basename, now_tm.tm_year + 1900, + return fmt_lib::format(SPDLOG_FILENAME_T("{}_{:04d}-{:02d}-{:02d}{}"), basename, now_tm.tm_year + 1900, now_tm.tm_mon + 1, now_tm.tm_mday, ext); } };