From 0a4ccf22da852692410940584f754cc0be36ecee Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Mon, 14 Jan 2019 11:39:35 +0200 Subject: [PATCH 1/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5509ef30..48264324 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ int main() spdlog::info("Positional args are {1} {0}..", "too", "supported"); spdlog::info("{:<30}", "left aligned"); - spdlog::set_level(spdlog::level::debug/ Set global log level to debug + spdlog::set_level(spdlog::level::debug); // Set global log level to debug spdlog::debug("This message should be displayed.."); // change log pattern From 611df4964dc7092721b42c3f7fb0022f46bf9d40 Mon Sep 17 00:00:00 2001 From: myd7349 Date: Mon, 14 Jan 2019 20:18:35 +0800 Subject: [PATCH 2/7] Fix #961 benchmark link error --- bench/CMakeLists.txt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/bench/CMakeLists.txt b/bench/CMakeLists.txt index 31636d66..3c4a3f9d 100644 --- a/bench/CMakeLists.txt +++ b/bench/CMakeLists.txt @@ -30,20 +30,19 @@ if(NOT TARGET spdlog) endif() find_package(Threads REQUIRED) +find_package(benchmark CONFIG REQUIRED) add_executable(bench bench.cpp) -target_link_libraries(bench spdlog::spdlog Threads::Threads) +target_link_libraries(bench PRIVATE spdlog::spdlog Threads::Threads) add_executable(async_bench async_bench.cpp) -target_link_libraries(async_bench spdlog::spdlog Threads::Threads) +target_link_libraries(async_bench PRIVATE spdlog::spdlog Threads::Threads) add_executable(latency latency.cpp) -set(CMAKE_CXX_STANDARD_LIBRARIES -lbenchmark) -target_link_libraries(latency spdlog::spdlog Threads::Threads) +target_link_libraries(latency PRIVATE benchmark::benchmark spdlog::spdlog Threads::Threads) add_executable(formatter-bench formatter-bench.cpp) -set(CMAKE_CXX_STANDARD_LIBRARIES -lbenchmark) -target_link_libraries(formatter-bench spdlog::spdlog Threads::Threads) +target_link_libraries(formatter-bench PRIVATE benchmark::benchmark spdlog::spdlog Threads::Threads) file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/logs") From 1798a1fa12dec15b9332e19095d102c5cc6a974d Mon Sep 17 00:00:00 2001 From: scribam Date: Thu, 17 Jan 2019 00:23:06 +0100 Subject: [PATCH 3/7] Update log_msg.h `SPDLOG_NO_THREAD_ID` should only affect thread retrieval. --- include/spdlog/details/log_msg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/spdlog/details/log_msg.h b/include/spdlog/details/log_msg.h index 5913c3b0..69422ba3 100644 --- a/include/spdlog/details/log_msg.h +++ b/include/spdlog/details/log_msg.h @@ -25,9 +25,9 @@ struct log_msg #ifndef SPDLOG_NO_THREAD_ID , thread_id(os::thread_id()) +#endif , source(loc) , payload(view) -#endif { } From 23fdc0eae426ac2efadf9f4bb1f43caae1667bc7 Mon Sep 17 00:00:00 2001 From: gabime Date: Thu, 17 Jan 2019 17:09:35 +0200 Subject: [PATCH 4/7] Fixed issue #959 --- include/spdlog/sinks/android_sink.h | 2 +- include/spdlog/sinks/ansicolor_sink.h | 2 +- include/spdlog/sinks/basic_file_sink.h | 2 +- include/spdlog/sinks/daily_file_sink.h | 2 +- include/spdlog/sinks/dist_sink.h | 2 +- include/spdlog/sinks/msvc_sink.h | 2 +- include/spdlog/sinks/null_sink.h | 2 +- include/spdlog/sinks/ostream_sink.h | 2 +- include/spdlog/sinks/rotating_file_sink.h | 2 +- include/spdlog/sinks/stdout_color_sinks.h | 2 +- include/spdlog/sinks/stdout_sinks.h | 2 +- include/spdlog/sinks/syslog_sink.h | 2 +- include/spdlog/sinks/wincolor_sink.h | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/spdlog/sinks/android_sink.h b/include/spdlog/sinks/android_sink.h index 0742b247..ae7f7733 100644 --- a/include/spdlog/sinks/android_sink.h +++ b/include/spdlog/sinks/android_sink.h @@ -6,7 +6,7 @@ #pragma once #ifndef SPDLOG_H -#error "spdlog.h must be included before this file." +#include "spdlog/spdlog.h" #endif #include "spdlog/details/fmt_helper.h" diff --git a/include/spdlog/sinks/ansicolor_sink.h b/include/spdlog/sinks/ansicolor_sink.h index bb2a2a12..7c5e3539 100644 --- a/include/spdlog/sinks/ansicolor_sink.h +++ b/include/spdlog/sinks/ansicolor_sink.h @@ -6,7 +6,7 @@ #pragma once #ifndef SPDLOG_H -#error "spdlog.h must be included before this file." +#include "spdlog/spdlog.h" #endif #include "spdlog/details/console_globals.h" diff --git a/include/spdlog/sinks/basic_file_sink.h b/include/spdlog/sinks/basic_file_sink.h index 0ab884aa..bc5fb5c3 100644 --- a/include/spdlog/sinks/basic_file_sink.h +++ b/include/spdlog/sinks/basic_file_sink.h @@ -6,7 +6,7 @@ #pragma once #ifndef SPDLOG_H -#error "spdlog.h must be included before this file." +#include "spdlog/spdlog.h" #endif #include "spdlog/details/file_helper.h" diff --git a/include/spdlog/sinks/daily_file_sink.h b/include/spdlog/sinks/daily_file_sink.h index d20de442..7bf7c448 100644 --- a/include/spdlog/sinks/daily_file_sink.h +++ b/include/spdlog/sinks/daily_file_sink.h @@ -6,7 +6,7 @@ #pragma once #ifndef SPDLOG_H -#error "spdlog.h must be included before this file." +#include "spdlog/spdlog.h" #endif #include "spdlog/details/file_helper.h" diff --git a/include/spdlog/sinks/dist_sink.h b/include/spdlog/sinks/dist_sink.h index 8ed41f1a..44de3913 100644 --- a/include/spdlog/sinks/dist_sink.h +++ b/include/spdlog/sinks/dist_sink.h @@ -6,7 +6,7 @@ #pragma once #ifndef SPDLOG_H -#error "spdlog.h must be included before this file." +#include "spdlog/spdlog.h" #endif #include "base_sink.h" diff --git a/include/spdlog/sinks/msvc_sink.h b/include/spdlog/sinks/msvc_sink.h index c8e60be7..f06c16c7 100644 --- a/include/spdlog/sinks/msvc_sink.h +++ b/include/spdlog/sinks/msvc_sink.h @@ -6,7 +6,7 @@ #pragma once #ifndef SPDLOG_H -#error "spdlog.h must be included before this file." +#include "spdlog/spdlog.h" #endif #if defined(_WIN32) diff --git a/include/spdlog/sinks/null_sink.h b/include/spdlog/sinks/null_sink.h index ffab7a52..54f322c4 100644 --- a/include/spdlog/sinks/null_sink.h +++ b/include/spdlog/sinks/null_sink.h @@ -6,7 +6,7 @@ #pragma once #ifndef SPDLOG_H -#error "spdlog.h must be included before this file." +#include "spdlog/spdlog.h" #endif #include "spdlog/details/null_mutex.h" diff --git a/include/spdlog/sinks/ostream_sink.h b/include/spdlog/sinks/ostream_sink.h index b28802a0..22e377b6 100644 --- a/include/spdlog/sinks/ostream_sink.h +++ b/include/spdlog/sinks/ostream_sink.h @@ -6,7 +6,7 @@ #pragma once #ifndef SPDLOG_H -#error "spdlog.h must be included before this file." +#include "spdlog/spdlog.h" #endif #include "spdlog/details/null_mutex.h" diff --git a/include/spdlog/sinks/rotating_file_sink.h b/include/spdlog/sinks/rotating_file_sink.h index 73c377d4..a579946f 100644 --- a/include/spdlog/sinks/rotating_file_sink.h +++ b/include/spdlog/sinks/rotating_file_sink.h @@ -6,7 +6,7 @@ #pragma once #ifndef SPDLOG_H -#error "spdlog.h must be included before this file." +#include "spdlog/spdlog.h" #endif #include "spdlog/details/file_helper.h" diff --git a/include/spdlog/sinks/stdout_color_sinks.h b/include/spdlog/sinks/stdout_color_sinks.h index f0475692..74bfceb4 100644 --- a/include/spdlog/sinks/stdout_color_sinks.h +++ b/include/spdlog/sinks/stdout_color_sinks.h @@ -6,7 +6,7 @@ #pragma once #ifndef SPDLOG_H -#error "spdlog.h must be included before this file." +#include "spdlog/spdlog.h" #endif #ifdef _WIN32 diff --git a/include/spdlog/sinks/stdout_sinks.h b/include/spdlog/sinks/stdout_sinks.h index efbbaaac..bf8e9790 100644 --- a/include/spdlog/sinks/stdout_sinks.h +++ b/include/spdlog/sinks/stdout_sinks.h @@ -6,7 +6,7 @@ #pragma once #ifndef SPDLOG_H -#error "spdlog.h must be included before this file." +#include "spdlog/spdlog.h" #endif #include "spdlog/details/console_globals.h" diff --git a/include/spdlog/sinks/syslog_sink.h b/include/spdlog/sinks/syslog_sink.h index 4df49b87..c3bcd844 100644 --- a/include/spdlog/sinks/syslog_sink.h +++ b/include/spdlog/sinks/syslog_sink.h @@ -6,7 +6,7 @@ #pragma once #ifndef SPDLOG_H -#error "spdlog.h must be included before this file." +#include "spdlog/spdlog.h" #endif #include "spdlog/sinks/base_sink.h" diff --git a/include/spdlog/sinks/wincolor_sink.h b/include/spdlog/sinks/wincolor_sink.h index 6e2b0122..1fdf8c56 100644 --- a/include/spdlog/sinks/wincolor_sink.h +++ b/include/spdlog/sinks/wincolor_sink.h @@ -6,7 +6,7 @@ #pragma once #ifndef SPDLOG_H -#error "spdlog.h must be included before this file." +#include "spdlog/spdlog.h" #endif #include "spdlog/common.h" From a7148b718ea2fabb8387cb90aee9bf448da63e65 Mon Sep 17 00:00:00 2001 From: gabime Date: Fri, 18 Jan 2019 12:13:07 +0200 Subject: [PATCH 5/7] Version 1.3.1 --- CMakeLists.txt | 2 +- include/spdlog/version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e1d96563..cf2d04f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ # cmake_minimum_required(VERSION 3.1) -project(spdlog VERSION 1.3.0 LANGUAGES CXX) +project(spdlog VERSION 1.3.1 LANGUAGES CXX) include(CMakeDependentOption) include(GNUInstallDirs) diff --git a/include/spdlog/version.h b/include/spdlog/version.h index 16b9194b..87a68bd1 100644 --- a/include/spdlog/version.h +++ b/include/spdlog/version.h @@ -7,6 +7,6 @@ #define SPDLOG_VER_MAJOR 1 #define SPDLOG_VER_MINOR 3 -#define SPDLOG_VER_PATCH 0 +#define SPDLOG_VER_PATCH 1 #define SPDLOG_VERSION (SPDLOG_VER_MAJOR * 10000 + SPDLOG_VER_MINOR * 100 + SPDLOG_VER_PATCH) From a29e518cfebb5d5f1be0110b82bb7917112d45c1 Mon Sep 17 00:00:00 2001 From: Pius Raeder Date: Wed, 23 Jan 2019 10:03:03 +0100 Subject: [PATCH 6/7] Disable building benchmarks by default Building the benchmarks requires google-benchmark to be installed which is not the case for most of the build systems. The option now has a tiny hint what the requirement is and where to get it. closes #975 --- CMakeLists.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cf2d04f5..eaf9d802 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,7 +30,6 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCH add_compile_options("-Wconversion") add_compile_options("-pedantic") add_compile_options("-Wfatal-errors") - endif() #--------------------------------------------------------------------------------------- @@ -47,11 +46,11 @@ add_library(spdlog::spdlog ALIAS spdlog) # Check if spdlog is being used directly or via add_subdirectory set(SPDLOG_MASTER_PROJECT OFF) if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) - set(SPDLOG_MASTER_PROJECT ON) + set(SPDLOG_MASTER_PROJECT ON) endif() option(SPDLOG_BUILD_EXAMPLES "Build examples" ${SPDLOG_MASTER_PROJECT}) -option(SPDLOG_BUILD_BENCH "Build benchmarks" ${SPDLOG_MASTER_PROJECT}) +option(SPDLOG_BUILD_BENCH "Build benchmarks (Requires https://github.com/google/benchmark.git to be installed)" OFF) option(SPDLOG_BUILD_TESTS "Build tests" ${SPDLOG_MASTER_PROJECT}) option(SPDLOG_FMT_EXTERNAL "Use external fmt library instead of bundled" OFF) From 6e2dadc63a7c7e24d98eba956fe6e69e0e66ba6f Mon Sep 17 00:00:00 2001 From: Mark Niebur Date: Wed, 23 Jan 2019 11:35:55 -0700 Subject: [PATCH 7/7] Add method to filesinks to return filename --- include/spdlog/sinks/basic_file_sink.h | 5 +++++ include/spdlog/sinks/daily_file_sink.h | 5 +++++ include/spdlog/sinks/rotating_file_sink.h | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/include/spdlog/sinks/basic_file_sink.h b/include/spdlog/sinks/basic_file_sink.h index bc5fb5c3..facc7209 100644 --- a/include/spdlog/sinks/basic_file_sink.h +++ b/include/spdlog/sinks/basic_file_sink.h @@ -30,6 +30,11 @@ public: file_helper_.open(filename, truncate); } + const filename_t &filename() const + { + return file_helper_.filename(); + } + protected: void sink_it_(const details::log_msg &msg) override { diff --git a/include/spdlog/sinks/daily_file_sink.h b/include/spdlog/sinks/daily_file_sink.h index 7bf7c448..08392c16 100644 --- a/include/spdlog/sinks/daily_file_sink.h +++ b/include/spdlog/sinks/daily_file_sink.h @@ -63,6 +63,11 @@ public: rotation_tp_ = next_rotation_tp_(); } + const filename_t &filename() const + { + return file_helper_.filename(); + } + protected: void sink_it_(const details::log_msg &msg) override { diff --git a/include/spdlog/sinks/rotating_file_sink.h b/include/spdlog/sinks/rotating_file_sink.h index a579946f..87784f1b 100644 --- a/include/spdlog/sinks/rotating_file_sink.h +++ b/include/spdlog/sinks/rotating_file_sink.h @@ -58,6 +58,11 @@ public: return fmt::to_string(w); } + const filename_t &filename() const + { + return file_helper_.filename(); + } + protected: void sink_it_(const details::log_msg &msg) override {