mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-29 09:59:33 +08:00
Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
100f30043f | ||
![]() |
1574b5b0a2 | ||
![]() |
012fe99ab1 | ||
![]() |
8ff5a3e096 | ||
![]() |
65317eb019 | ||
![]() |
ac3e26b0ff | ||
![]() |
e86f450428 | ||
![]() |
7b2776fdc7 | ||
![]() |
2a16d1d230 | ||
![]() |
a2e28443f0 |
@@ -178,7 +178,7 @@ target_link_libraries(spdlog_header_only INTERFACE Threads::Threads)
|
|||||||
# ---------------------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------------------
|
||||||
if(SPDLOG_FMT_EXTERNAL OR SPDLOG_FMT_EXTERNAL_HO)
|
if(SPDLOG_FMT_EXTERNAL OR SPDLOG_FMT_EXTERNAL_HO)
|
||||||
if(NOT TARGET fmt::fmt)
|
if(NOT TARGET fmt::fmt)
|
||||||
find_package(fmt 5.3.0 CONFIG REQUIRED)
|
find_package(fmt CONFIG REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
target_compile_definitions(spdlog PUBLIC SPDLOG_FMT_EXTERNAL)
|
target_compile_definitions(spdlog PUBLIC SPDLOG_FMT_EXTERNAL)
|
||||||
target_compile_definitions(spdlog_header_only INTERFACE SPDLOG_FMT_EXTERNAL)
|
target_compile_definitions(spdlog_header_only INTERFACE SPDLOG_FMT_EXTERNAL)
|
||||||
@@ -195,6 +195,14 @@ if(SPDLOG_FMT_EXTERNAL OR SPDLOG_FMT_EXTERNAL_HO)
|
|||||||
set(PKG_CONFIG_REQUIRES fmt) # add dependency to pkg-config
|
set(PKG_CONFIG_REQUIRES fmt) # add dependency to pkg-config
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------------------
|
||||||
|
# Add required libraries for Android CMake build
|
||||||
|
# ---------------------------------------------------------------------------------------
|
||||||
|
if (ANDROID)
|
||||||
|
target_link_libraries(spdlog PUBLIC log)
|
||||||
|
target_link_libraries(spdlog_header_only INTERFACE log)
|
||||||
|
endif ()
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------------------
|
||||||
# Misc definitions according to tweak options
|
# Misc definitions according to tweak options
|
||||||
# ---------------------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------------------
|
||||||
|
@@ -10,9 +10,6 @@
|
|||||||
namespace spdlog {
|
namespace spdlog {
|
||||||
namespace level {
|
namespace level {
|
||||||
|
|
||||||
#if __cplusplus >= 201703L
|
|
||||||
constexpr
|
|
||||||
#endif
|
|
||||||
static string_view_t level_string_views[] SPDLOG_LEVEL_NAMES;
|
static string_view_t level_string_views[] SPDLOG_LEVEL_NAMES;
|
||||||
|
|
||||||
static const char *short_level_names[] SPDLOG_SHORT_LEVEL_NAMES;
|
static const char *short_level_names[] SPDLOG_SHORT_LEVEL_NAMES;
|
||||||
@@ -22,6 +19,11 @@ SPDLOG_INLINE const string_view_t &to_string_view(spdlog::level::level_enum l) S
|
|||||||
return level_string_views[l];
|
return level_string_views[l];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SPDLOG_INLINE void set_string_view(spdlog::level::level_enum l, const string_view_t &s) SPDLOG_NOEXCEPT
|
||||||
|
{
|
||||||
|
level_string_views[l] = s;
|
||||||
|
}
|
||||||
|
|
||||||
SPDLOG_INLINE const char *to_short_c_str(spdlog::level::level_enum l) SPDLOG_NOEXCEPT
|
SPDLOG_INLINE const char *to_short_c_str(spdlog::level::level_enum l) SPDLOG_NOEXCEPT
|
||||||
{
|
{
|
||||||
return short_level_names[l];
|
return short_level_names[l];
|
||||||
|
@@ -167,6 +167,7 @@ enum level_enum
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
SPDLOG_API const string_view_t &to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT;
|
SPDLOG_API const string_view_t &to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT;
|
||||||
|
SPDLOG_API void set_string_view(spdlog::level::level_enum l, const string_view_t &s) SPDLOG_NOEXCEPT;
|
||||||
SPDLOG_API const char *to_short_c_str(spdlog::level::level_enum l) SPDLOG_NOEXCEPT;
|
SPDLOG_API const char *to_short_c_str(spdlog::level::level_enum l) SPDLOG_NOEXCEPT;
|
||||||
SPDLOG_API spdlog::level::level_enum from_str(const std::string &name) SPDLOG_NOEXCEPT;
|
SPDLOG_API spdlog::level::level_enum from_str(const std::string &name) SPDLOG_NOEXCEPT;
|
||||||
|
|
||||||
|
@@ -5,6 +5,6 @@
|
|||||||
|
|
||||||
#define SPDLOG_VER_MAJOR 1
|
#define SPDLOG_VER_MAJOR 1
|
||||||
#define SPDLOG_VER_MINOR 8
|
#define SPDLOG_VER_MINOR 8
|
||||||
#define SPDLOG_VER_PATCH 3
|
#define SPDLOG_VER_PATCH 5
|
||||||
|
|
||||||
#define SPDLOG_VERSION (SPDLOG_VER_MAJOR * 10000 + SPDLOG_VER_MINOR * 100 + SPDLOG_VER_PATCH)
|
#define SPDLOG_VERSION (SPDLOG_VER_MAJOR * 10000 + SPDLOG_VER_MINOR * 100 + SPDLOG_VER_PATCH)
|
||||||
|
@@ -55,6 +55,14 @@ TEST_CASE("level_to_string_view", "[convert_to_string_view")
|
|||||||
REQUIRE(spdlog::level::to_string_view(spdlog::level::off) == "off");
|
REQUIRE(spdlog::level::to_string_view(spdlog::level::off) == "off");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("set_level_to_string_view", "[set_string_view")
|
||||||
|
{
|
||||||
|
spdlog::level::set_string_view(spdlog::level::info, "INF");
|
||||||
|
REQUIRE(spdlog::level::to_string_view(spdlog::level::info) == "INF");
|
||||||
|
spdlog::level::set_string_view(spdlog::level::info, "info"); // set it back
|
||||||
|
REQUIRE(spdlog::level::to_string_view(spdlog::level::info) == "info");
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE("to_short_c_str", "[convert_to_short_c_str]")
|
TEST_CASE("to_short_c_str", "[convert_to_short_c_str]")
|
||||||
{
|
{
|
||||||
REQUIRE(std::string(spdlog::level::to_short_c_str(spdlog::level::trace)) == "T");
|
REQUIRE(std::string(spdlog::level::to_short_c_str(spdlog::level::trace)) == "T");
|
||||||
|
Reference in New Issue
Block a user