mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-27 03:00:46 +08:00
alwaus use std::string_view
This commit is contained in:
parent
62534f2e4e
commit
fb3969d540
@ -95,28 +95,28 @@ using sink_ptr = std::shared_ptr<sinks::sink>;
|
||||
using sinks_init_list = std::initializer_list<sink_ptr>;
|
||||
using err_handler = std::function<void(const std::string &err_msg)>;
|
||||
|
||||
using string_view_t = std::basic_string_view<char>;
|
||||
using wstring_view_t = std::basic_string_view<wchar_t>;
|
||||
|
||||
#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 <typename... Args>
|
||||
#if __cpp_lib_format >= 202207L
|
||||
using format_string_t = std::format_string<Args...>;
|
||||
using format_string_t = std::format_string<Args...>;
|
||||
#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<char>;
|
||||
|
||||
using memory_buf_t = fmt::basic_memory_buffer<char, 250>;
|
||||
template <typename... Args>
|
||||
using format_string_t = fmt::format_string<Args...>;
|
||||
using wstring_view_t = fmt::basic_string_view<wchar_t>;
|
||||
using wmemory_buf_t = fmt::basic_memory_buffer<wchar_t, 250>;
|
||||
#define SPDLOG_BUF_TO_STRING(x) fmt::to_string(x)
|
||||
#endif // SPDLOG_USE_STD_FORMAT
|
||||
|
@ -192,7 +192,7 @@ protected:
|
||||
// common implementation for after templated public api has been resolved to format string and
|
||||
// args
|
||||
template <typename... Args>
|
||||
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<Args...> fmt, Args &&...args) {
|
||||
assert(should_log(lvl));
|
||||
SPDLOG_TRY {
|
||||
#ifdef SPDLOG_USE_STD_FORMAT
|
||||
|
Loading…
Reference in New Issue
Block a user