From fb3969d540e3a98b3b3856e074c9502ce929d038 Mon Sep 17 00:00:00 2001 From: gabime Date: Fri, 29 Nov 2024 13:52:17 +0200 Subject: [PATCH] alwaus use std::string_view --- include/spdlog/common.h | 12 ++++++------ include/spdlog/logger.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/spdlog/common.h b/include/spdlog/common.h index 63d0fceb..b98cbd55 100644 --- a/include/spdlog/common.h +++ b/include/spdlog/common.h @@ -95,28 +95,28 @@ using sink_ptr = std::shared_ptr; using sinks_init_list = std::initializer_list; using err_handler = std::function; +using string_view_t = std::basic_string_view; +using wstring_view_t = std::basic_string_view; + #ifdef SPDLOG_USE_STD_FORMAT namespace fmt_lib = std; -using string_view_t = std::string_view; using memory_buf_t = std::string; -using wstring_view_t = std::wstring_view; using wmemory_buf_t = std::wstring; template #if __cpp_lib_format >= 202207L -using format_string_t = std::format_string; + using format_string_t = std::format_string; #else -using format_string_t = std::string_view; + using format_string_t = std::string_view; #endif #define SPDLOG_BUF_TO_STRING(x) x #else // use fmt lib instead of std::format namespace fmt_lib = fmt; -using string_view_t = fmt::basic_string_view; + using memory_buf_t = fmt::basic_memory_buffer; template using format_string_t = fmt::format_string; -using wstring_view_t = fmt::basic_string_view; using wmemory_buf_t = fmt::basic_memory_buffer; #define SPDLOG_BUF_TO_STRING(x) fmt::to_string(x) #endif // SPDLOG_USE_STD_FORMAT diff --git a/include/spdlog/logger.h b/include/spdlog/logger.h index dff17f4f..f82f4a53 100644 --- a/include/spdlog/logger.h +++ b/include/spdlog/logger.h @@ -192,7 +192,7 @@ protected: // common implementation for after templated public api has been resolved to format string and // args template - void log_with_format_(source_loc loc, level lvl, string_view_t fmt, Args &&...args) { + void log_with_format_(source_loc loc, level lvl, format_string_t fmt, Args &&...args) { assert(should_log(lvl)); SPDLOG_TRY { #ifdef SPDLOG_USE_STD_FORMAT