mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-30 10:29:02 +08:00
V2.x no std format (#3271)
* Removed SPDLOG_USE_STD_FORMAT * Removed SPDLOG_USE_STD_FORMAT * clang-format * Fix windows.yml ci * Fix ci
This commit is contained in:
@@ -19,12 +19,12 @@ if(Catch2_FOUND)
|
||||
else()
|
||||
message(STATUS "Bundled version of Catch will be downloaded and used.")
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(Catch2
|
||||
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
||||
GIT_TAG 53d0d913a422d356b23dd927547febdf69ee9081 # v3.5.0
|
||||
FetchContent_Declare(
|
||||
Catch2 GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
||||
GIT_TAG 53d0d913a422d356b23dd927547febdf69ee9081 # v3.5.0
|
||||
)
|
||||
FetchContent_MakeAvailable(Catch2)
|
||||
set_target_properties(Catch2 Catch2WithMain PROPERTIES FOLDER "third-party")
|
||||
set_target_properties(Catch2 Catch2WithMain PROPERTIES FOLDER "third-party")
|
||||
endif()
|
||||
|
||||
set(SPDLOG_UTESTS_SOURCES
|
||||
@@ -52,7 +52,8 @@ set(SPDLOG_UTESTS_SOURCES
|
||||
test_source_location.cpp
|
||||
test_no_source_location.cpp
|
||||
test_log_level.cpp
|
||||
test_include_sinks.cpp)
|
||||
test_include_sinks.cpp
|
||||
test_bin_to_hex.cpp)
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND SPDLOG_UTESTS_SOURCES test_eventlog.cpp)
|
||||
@@ -66,10 +67,6 @@ if(systemd_FOUND)
|
||||
list(APPEND SPDLOG_UTESTS_SOURCES test_systemd.cpp)
|
||||
endif()
|
||||
|
||||
if(NOT SPDLOG_USE_STD_FORMAT)
|
||||
list(APPEND SPDLOG_UTESTS_SOURCES test_bin_to_hex.cpp)
|
||||
endif()
|
||||
|
||||
enable_testing()
|
||||
|
||||
function(spdlog_prepare_test test_target spdlog_lib)
|
||||
@@ -82,9 +79,9 @@ function(spdlog_prepare_test test_target spdlog_lib)
|
||||
target_link_libraries(${test_target} PRIVATE Catch2::Catch2WithMain)
|
||||
if(SPDLOG_SANITIZE_ADDRESS)
|
||||
spdlog_enable_addr_sanitizer(${test_target})
|
||||
elseif (SPDLOG_SANITIZE_THREAD)
|
||||
elseif(SPDLOG_SANITIZE_THREAD)
|
||||
spdlog_enable_thread_sanitizer(${test_target})
|
||||
endif ()
|
||||
endif()
|
||||
add_test(NAME ${test_target} COMMAND ${test_target})
|
||||
set_tests_properties(${test_target} PROPERTIES RUN_SERIAL ON)
|
||||
endfunction()
|
||||
|
@@ -81,8 +81,7 @@ TEST_CASE("dir_name", "[create_dir]") {
|
||||
// clang-format off
|
||||
#include <windows.h>
|
||||
#include <fileapi.h>
|
||||
// clang-format on
|
||||
|
||||
// clang-format on
|
||||
|
||||
std::string get_full_path(const std::string &relative_folder_path) {
|
||||
char full_path[MAX_PATH];
|
||||
|
@@ -6,11 +6,7 @@
|
||||
#include "spdlog/sinks/daily_file_sink.h"
|
||||
#include "spdlog/sinks/rotating_file_sink.h"
|
||||
|
||||
#ifdef SPDLOG_USE_STD_FORMAT
|
||||
using filename_memory_buf_t = std::basic_string<spdlog::filename_t::value_type>;
|
||||
#else
|
||||
using filename_memory_buf_t = fmt::basic_memory_buffer<spdlog::filename_t::value_type, 250>;
|
||||
#endif
|
||||
using filename_memory_buf_t = spdlog::memory_buf_t;
|
||||
|
||||
#ifdef SPDLOG_WCHAR_FILENAMES
|
||||
std::string filename_buf_to_utf8string(const filename_memory_buf_t &w) {
|
||||
|
@@ -18,7 +18,6 @@ protected:
|
||||
};
|
||||
struct custom_ex {};
|
||||
|
||||
#if !defined(SPDLOG_USE_STD_FORMAT) // std formt doesn't fully support runtime format strings
|
||||
TEST_CASE("default_error_handler", "[errors]") {
|
||||
prepare_logdir();
|
||||
spdlog::filename_t filename = SPDLOG_FILENAME_T(SIMPLE_LOG);
|
||||
@@ -45,7 +44,6 @@ TEST_CASE("custom_error_handler", "[errors]") {
|
||||
logger->info("Good message #2");
|
||||
require_message_count(SIMPLE_LOG, 2);
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_CASE("default_error_handler2", "[errors]") {
|
||||
spdlog::drop_all();
|
||||
@@ -61,7 +59,6 @@ TEST_CASE("flush_error_handler", "[errors]") {
|
||||
REQUIRE_THROWS_AS(logger->flush(), custom_ex);
|
||||
}
|
||||
|
||||
#if !defined(SPDLOG_USE_STD_FORMAT) // std formt doesn't fully support runtime format strings
|
||||
TEST_CASE("async_error_handler", "[errors]") {
|
||||
prepare_logdir();
|
||||
std::string err_msg("log failed with some msg");
|
||||
@@ -86,7 +83,6 @@ TEST_CASE("async_error_handler", "[errors]") {
|
||||
require_message_count(SIMPLE_ASYNC_LOG, 2);
|
||||
REQUIRE(file_contents("test_logs/custom_err.txt") == err_msg);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Make sure async error handler is executed
|
||||
TEST_CASE("async_error_handler2", "[errors]") {
|
||||
|
Reference in New Issue
Block a user