mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-29 01:29:35 +08:00
Update common.h
This commit is contained in:
@@ -123,7 +123,6 @@ using format_string_t = std::string_view;
|
|||||||
#define SPDLOG_BUF_TO_STRING(x) x
|
#define SPDLOG_BUF_TO_STRING(x) x
|
||||||
#else // use fmt lib instead of std::format
|
#else // use fmt lib instead of std::format
|
||||||
namespace fmt_lib = fmt;
|
namespace fmt_lib = fmt;
|
||||||
|
|
||||||
using string_view_t = fmt::basic_string_view<char>;
|
using string_view_t = fmt::basic_string_view<char>;
|
||||||
using memory_buf_t = fmt::basic_memory_buffer<char, 250>;
|
using memory_buf_t = fmt::basic_memory_buffer<char, 250>;
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
@@ -182,13 +181,13 @@ using atomic_level_t = std::atomic<level>;
|
|||||||
}
|
}
|
||||||
constexpr auto levels_count = level_to_number(level::n_levels);
|
constexpr auto levels_count = level_to_number(level::n_levels);
|
||||||
constexpr std::array<string_view_t, levels_count> level_string_views SPDLOG_LEVEL_NAMES;
|
constexpr std::array<string_view_t, levels_count> level_string_views SPDLOG_LEVEL_NAMES;
|
||||||
constexpr std::array<const char *, levels_count> short_level_names SPDLOG_SHORT_LEVEL_NAMES;
|
constexpr std::array<string_view_t, levels_count> short_level_names SPDLOG_SHORT_LEVEL_NAMES;
|
||||||
|
|
||||||
[[nodiscard]] constexpr string_view_t to_string_view(spdlog::level lvl) noexcept {
|
[[nodiscard]] constexpr string_view_t to_string_view(spdlog::level lvl) noexcept {
|
||||||
return level_string_views.at(level_to_number(lvl));
|
return level_string_views.at(level_to_number(lvl));
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] constexpr const char *to_short_c_str(spdlog::level lvl) noexcept {
|
[[nodiscard]] constexpr const char *to_short_string_view(spdlog::level lvl) noexcept {
|
||||||
return short_level_names.at(level_to_number(lvl));
|
return short_level_names.at(level_to_number(lvl));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user