From da51d8dfd351561e7e4dc26b5008569df1a3c994 Mon Sep 17 00:00:00 2001 From: Ryan Carmichael Date: Wed, 24 Jan 2018 14:18:05 -0600 Subject: [PATCH 1/4] Fixed spelling mistake in example.cpp --- example/example.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/example/example.cpp b/example/example.cpp index c9aee7ad..cf747834 100644 --- a/example/example.cpp +++ b/example/example.cpp @@ -64,9 +64,9 @@ int main(int, char*[]) // Runtime log levels spd::set_level(spd::level::info); //Set global log level to info - console->debug("This message shold not be displayed!"); + console->debug("This message should not be displayed!"); console->set_level(spd::level::debug); // Set specific logger's log level - console->debug("This message shold be displayed.."); + console->debug("This message should be displayed.."); // Compile time log levels // define SPDLOG_DEBUG_ON or SPDLOG_TRACE_ON From 38ccd513992f09f952d878fbb7d2cfbb2d189d74 Mon Sep 17 00:00:00 2001 From: yisonPylkita Date: Sun, 28 Jan 2018 00:24:14 +0100 Subject: [PATCH 2/4] Modern CMake in /tests --- tests/CMakeLists.txt | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 22329b4e..94bf8e76 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,19 +1,23 @@ -# -# Tests -# +project(spdlog-utests) enable_testing() +find_package(Threads REQUIRED) -find_package(Threads) +set(SPDLOG_UTESTS_SOURCES + errors.cpp + file_helper.cpp + file_log.cpp + format.cpp + includes.h + registry.cpp + test_macros.cpp + utils.cpp + utils.h + main.cpp) -# Build Catch unit tests -add_library(catch INTERFACE) -target_include_directories(catch INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) +add_executable(${PROJECT_NAME} ${SPDLOG_UTESTS_SOURCES}) +target_link_libraries(${PROJECT_NAME} PRIVATE Threads::Threads) +target_link_libraries(${PROJECT_NAME} PRIVATE spdlog) -file(GLOB catch_tests LIST_DIRECTORIES false RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp *.h *.hpp) - -add_executable(catch_tests ${catch_tests}) -target_link_libraries(catch_tests spdlog ${CMAKE_THREAD_LIBS_INIT}) -add_test(NAME catch_tests COMMAND catch_tests) +add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME}) file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/logs") - From 51a83da578b7944d83b9035e09176082022d99da Mon Sep 17 00:00:00 2001 From: gabime Date: Sat, 3 Feb 2018 18:57:57 +0200 Subject: [PATCH 3/4] Repplaced map with unordered_map for level->colos mapping --- include/spdlog/sinks/ansicolor_sink.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/spdlog/sinks/ansicolor_sink.h b/include/spdlog/sinks/ansicolor_sink.h index 29097313..907842d5 100644 --- a/include/spdlog/sinks/ansicolor_sink.h +++ b/include/spdlog/sinks/ansicolor_sink.h @@ -10,7 +10,7 @@ #include "../details/os.h" #include -#include +#include namespace spdlog { @@ -102,7 +102,7 @@ protected: } FILE* target_file_; bool should_do_colors_; - std::map colors_; + std::unordered_map colors_; }; From 5ab033fba5710fc9fc7fbff901e27a8d9d92778e Mon Sep 17 00:00:00 2001 From: gabime Date: Mon, 5 Feb 2018 12:20:57 +0200 Subject: [PATCH 4/4] Fix issue #629 --- include/spdlog/common.h | 2 ++ include/spdlog/sinks/ansicolor_sink.h | 2 +- include/spdlog/sinks/wincolor_sink.h | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/spdlog/common.h b/include/spdlog/common.h index ea0b0567..0dde700c 100644 --- a/include/spdlog/common.h +++ b/include/spdlog/common.h @@ -98,6 +98,8 @@ inline const char* to_short_str(spdlog::level::level_enum l) { return short_level_names[l]; } +using level_hasher = std::hash; + } //level diff --git a/include/spdlog/sinks/ansicolor_sink.h b/include/spdlog/sinks/ansicolor_sink.h index a6e58250..bd0e3222 100644 --- a/include/spdlog/sinks/ansicolor_sink.h +++ b/include/spdlog/sinks/ansicolor_sink.h @@ -104,7 +104,7 @@ protected: } FILE* target_file_; bool should_do_colors_; - std::unordered_map colors_; + std::unordered_map colors_; }; diff --git a/include/spdlog/sinks/wincolor_sink.h b/include/spdlog/sinks/wincolor_sink.h index 8ee3d894..f9e86c7a 100644 --- a/include/spdlog/sinks/wincolor_sink.h +++ b/include/spdlog/sinks/wincolor_sink.h @@ -11,7 +11,7 @@ #include #include -#include +#include #include namespace spdlog @@ -73,7 +73,7 @@ protected: private: HANDLE out_handle_; - std::map colors_; + std::unordered_map colors_; // set color and return the orig console attributes (for resetting later) WORD set_console_attribs(WORD attribs)