diff --git a/include/spdlog/details/console_globals.h b/include/spdlog/details/console_globals.h index 9c552106..52a8929a 100644 --- a/include/spdlog/details/console_globals.h +++ b/include/spdlog/details/console_globals.h @@ -3,8 +3,8 @@ #pragma once +#include "null_mutex.h" #include -#include namespace spdlog { namespace details { diff --git a/include/spdlog/details/file_helper.h b/include/spdlog/details/file_helper.h index 50ebf61f..6d406ac6 100644 --- a/include/spdlog/details/file_helper.h +++ b/include/spdlog/details/file_helper.h @@ -3,7 +3,7 @@ #pragma once -#include +#include "../common.h" #include namespace spdlog { diff --git a/include/spdlog/details/fmt_helper.h b/include/spdlog/details/fmt_helper.h index 62812d72..1786a124 100644 --- a/include/spdlog/details/fmt_helper.h +++ b/include/spdlog/details/fmt_helper.h @@ -2,10 +2,11 @@ // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once +#include "../common.h" +#include "../fmt/fmt.h" + #include #include -#include -#include #include #ifdef SPDLOG_USE_STD_FORMAT diff --git a/include/spdlog/details/log_msg.h b/include/spdlog/details/log_msg.h index 581be209..b7f0b51d 100644 --- a/include/spdlog/details/log_msg.h +++ b/include/spdlog/details/log_msg.h @@ -3,7 +3,7 @@ #pragma once -#include +#include "../common.h" #include namespace spdlog { diff --git a/include/spdlog/details/log_msg_buffer.h b/include/spdlog/details/log_msg_buffer.h index e7057836..fc7b2cbd 100644 --- a/include/spdlog/details/log_msg_buffer.h +++ b/include/spdlog/details/log_msg_buffer.h @@ -3,7 +3,7 @@ #pragma once -#include +#include "log_msg.h" namespace spdlog { namespace details { diff --git a/include/spdlog/details/mpmc_blocking_q.h b/include/spdlog/details/mpmc_blocking_q.h index 5a474bf3..5ef71c1c 100644 --- a/include/spdlog/details/mpmc_blocking_q.h +++ b/include/spdlog/details/mpmc_blocking_q.h @@ -10,7 +10,7 @@ // dequeue_for(..) - will block until the queue is not empty or timeout have // passed. -#include +#include "circular_q.h" #include #include diff --git a/include/spdlog/details/os.h b/include/spdlog/details/os.h index a63b0179..16aa695d 100644 --- a/include/spdlog/details/os.h +++ b/include/spdlog/details/os.h @@ -3,8 +3,8 @@ #pragma once +#include "../common.h" #include // std::time_t -#include namespace spdlog { namespace details { diff --git a/include/spdlog/details/periodic_worker.h b/include/spdlog/details/periodic_worker.h index 9866a509..767d3643 100644 --- a/include/spdlog/details/periodic_worker.h +++ b/include/spdlog/details/periodic_worker.h @@ -10,14 +10,14 @@ // stops and joins the thread on destruction (if the thread is executing a callback, wait for it // to finish first). +#include "../common.h" + #include #include #include #include #include -#include - namespace spdlog { namespace details { diff --git a/include/spdlog/details/registry.h b/include/spdlog/details/registry.h index f1f8b5cf..a4b21643 100644 --- a/include/spdlog/details/registry.h +++ b/include/spdlog/details/registry.h @@ -8,8 +8,8 @@ // If user requests a non existing logger, nullptr will be returned // This class is thread safe -#include -#include +#include "../common.h" +#include "periodic_worker.h" #include #include diff --git a/include/spdlog/details/tcp_client-windows.h b/include/spdlog/details/tcp_client-windows.h index bf8f7b87..b4fc626f 100644 --- a/include/spdlog/details/tcp_client-windows.h +++ b/include/spdlog/details/tcp_client-windows.h @@ -5,8 +5,8 @@ #define WIN32_LEAN_AND_MEAN // tcp client helper -#include -#include +#include "../common.h" +#include "os.h" #include #include diff --git a/include/spdlog/details/tcp_client.h b/include/spdlog/details/tcp_client.h index 9d3c40d5..93d55c21 100644 --- a/include/spdlog/details/tcp_client.h +++ b/include/spdlog/details/tcp_client.h @@ -8,8 +8,8 @@ #endif // tcp client helper -#include -#include +#include "../common.h" +#include "os.h" #include #include diff --git a/include/spdlog/details/thread_pool.h b/include/spdlog/details/thread_pool.h index 58693b53..f94af769 100644 --- a/include/spdlog/details/thread_pool.h +++ b/include/spdlog/details/thread_pool.h @@ -3,10 +3,10 @@ #pragma once -#include -#include -#include -#include +#include "../async.h" +#include "log_msg_buffer.h" +#include "mpmc_blocking_q.h" +#include "os.h" #include #include diff --git a/include/spdlog/details/udp_client-windows.h b/include/spdlog/details/udp_client-windows.h index 8b7c2232..64ae411e 100644 --- a/include/spdlog/details/udp_client-windows.h +++ b/include/spdlog/details/udp_client-windows.h @@ -6,8 +6,9 @@ // Helper RAII over winsock udp client socket. // Will throw on construction if socket creation failed. -#include -#include +#include "../common.h" +#include "os.h" + #include #include #include diff --git a/include/spdlog/details/udp_client.h b/include/spdlog/details/udp_client.h index 95826f5d..60bbdefa 100644 --- a/include/spdlog/details/udp_client.h +++ b/include/spdlog/details/udp_client.h @@ -6,6 +6,10 @@ // Helper RAII over unix udp client socket. // Will throw on construction if the socket creation failed. +#include "../common.h" +#include "os.h" + + #ifdef _WIN32 #error "include udp_client-windows.h instead" #endif @@ -15,11 +19,8 @@ #include #include #include -#include -#include #include #include - #include namespace spdlog { diff --git a/include/spdlog/sinks/android_sink.h b/include/spdlog/sinks/android_sink.h index 8a90fb57..aa527cfc 100644 --- a/include/spdlog/sinks/android_sink.h +++ b/include/spdlog/sinks/android_sink.h @@ -5,11 +5,11 @@ #ifdef __ANDROID__ - #include - #include - #include - #include - #include + #include "../details/fmt_helper.h" + #include "../details/null_mutex.h" + #include "os.h" + #include "../details/synchronous_factory.h" + #include "base_sink.h" #include #include diff --git a/include/spdlog/sinks/ansicolor_sink.h b/include/spdlog/sinks/ansicolor_sink.h index e7150806..e5f5c873 100644 --- a/include/spdlog/sinks/ansicolor_sink.h +++ b/include/spdlog/sinks/ansicolor_sink.h @@ -6,9 +6,9 @@ #include #include #include -#include -#include -#include +#include "../details/console_globals.h" +#include "../details/null_mutex.h" +#include "sink.h" #include namespace spdlog { diff --git a/include/spdlog/sinks/base_sink.h b/include/spdlog/sinks/base_sink.h index 60a1e307..50a7494b 100644 --- a/include/spdlog/sinks/base_sink.h +++ b/include/spdlog/sinks/base_sink.h @@ -9,9 +9,9 @@ // implementers.. // -#include -#include -#include +#include "../common.h" +#include "../details/log_msg.h" +#include "sink.h" namespace spdlog { namespace sinks { diff --git a/include/spdlog/sinks/basic_file_sink.h b/include/spdlog/sinks/basic_file_sink.h index f87df9b3..5c4a590c 100644 --- a/include/spdlog/sinks/basic_file_sink.h +++ b/include/spdlog/sinks/basic_file_sink.h @@ -3,10 +3,10 @@ #pragma once -#include -#include -#include -#include +#include "../details/file_helper.h" +#include "../details/null_mutex.h" +#include "../details/synchronous_factory.h" +#include "base_sink.h" #include #include diff --git a/include/spdlog/sinks/callback_sink.h b/include/spdlog/sinks/callback_sink.h index 71668ef2..cc87d741 100644 --- a/include/spdlog/sinks/callback_sink.h +++ b/include/spdlog/sinks/callback_sink.h @@ -3,9 +3,9 @@ #pragma once -#include -#include -#include +#include "../details/null_mutex.h" +#include "../details/synchronous_factory.h" +#include "base_sink.h" #include #include diff --git a/include/spdlog/sinks/daily_file_sink.h b/include/spdlog/sinks/daily_file_sink.h index b25538d4..5331cc7d 100644 --- a/include/spdlog/sinks/daily_file_sink.h +++ b/include/spdlog/sinks/daily_file_sink.h @@ -3,15 +3,15 @@ #pragma once -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "../common.h" +#include "../details/circular_q.h" +#include "../details/file_helper.h" +#include "../details/null_mutex.h" +#include "../details/os.h" +#include "../details/synchronous_factory.h" +#include "../fmt/chrono.h" +#include "../fmt/fmt.h" +#include "base_sink.h" #include #include diff --git a/include/spdlog/sinks/dist_sink.h b/include/spdlog/sinks/dist_sink.h index e759d2e7..3d3206f1 100644 --- a/include/spdlog/sinks/dist_sink.h +++ b/include/spdlog/sinks/dist_sink.h @@ -4,9 +4,9 @@ #pragma once #include "base_sink.h" -#include -#include -#include +#include "../details/log_msg.h" +#include "../details/null_mutex.h" +#include "../pattern_formatter.h" #include #include diff --git a/include/spdlog/sinks/dup_filter_sink.h b/include/spdlog/sinks/dup_filter_sink.h index a9e71025..d3e36bd8 100644 --- a/include/spdlog/sinks/dup_filter_sink.h +++ b/include/spdlog/sinks/dup_filter_sink.h @@ -4,8 +4,8 @@ #pragma once #include "dist_sink.h" -#include -#include +#include "../details/log_msg.h" +#include "../details/null_mutex.h" #include #include diff --git a/include/spdlog/sinks/hourly_file_sink.h b/include/spdlog/sinks/hourly_file_sink.h index 1f138925..f390d7d5 100644 --- a/include/spdlog/sinks/hourly_file_sink.h +++ b/include/spdlog/sinks/hourly_file_sink.h @@ -3,14 +3,14 @@ #pragma once -#include -#include -#include -#include -#include -#include -#include -#include +#include "../common.h" +#include "../details/circular_q.h" +#include "../details/file_helper.h" +#include "../details/null_mutex.h" +#include "../details/os.h" +#include "../details/synchronous_factory.h" +#include "../fmt/fmt.h" +#include "base_sink.h" #include #include diff --git a/include/spdlog/sinks/kafka_sink.h b/include/spdlog/sinks/kafka_sink.h index 91e98786..6e5020cb 100644 --- a/include/spdlog/sinks/kafka_sink.h +++ b/include/spdlog/sinks/kafka_sink.h @@ -10,13 +10,14 @@ // https://github.com/confluentinc/librdkafka // -#include "spdlog/async.h" -#include "spdlog/details/log_msg.h" -#include "spdlog/details/null_mutex.h" -#include "spdlog/details/synchronous_factory.h" -#include "spdlog/sinks/base_sink.h" +#include "base_sink.h" +#include "../async.h" +#include "../details/log_msg.h" +#include "../details/null_mutex.h" +#include "../details/synchronous_factory.h" + #include -#include +#include "../common.h" // kafka header #include diff --git a/include/spdlog/sinks/mongo_sink.h b/include/spdlog/sinks/mongo_sink.h index 1210f1e0..b6a212a4 100644 --- a/include/spdlog/sinks/mongo_sink.h +++ b/include/spdlog/sinks/mongo_sink.h @@ -10,10 +10,10 @@ // http://mongocxx.org/mongocxx-v3/installation/ // -#include "spdlog/common.h" -#include "spdlog/details/log_msg.h" -#include "spdlog/sinks/base_sink.h" -#include +#include "base_sink.h" +#include "../common.h" +#include "../details/log_msg.h" +#include "../details/synchronous_factory.h" #include #include @@ -78,7 +78,7 @@ private: std::unique_ptr client_ = nullptr; }; -#include "spdlog/details/null_mutex.h" +#include "../details/null_mutex.h" #include using mongo_sink_mt = mongo_sink; using mongo_sink_st = mongo_sink; diff --git a/include/spdlog/sinks/msvc_sink.h b/include/spdlog/sinks/msvc_sink.h index 3845674f..3c176b69 100644 --- a/include/spdlog/sinks/msvc_sink.h +++ b/include/spdlog/sinks/msvc_sink.h @@ -5,8 +5,8 @@ #if defined(_WIN32) - #include - #include + #include "../details/null_mutex.h" + #include "base_sink.h" #include #include diff --git a/include/spdlog/sinks/null_sink.h b/include/spdlog/sinks/null_sink.h index c51247fe..fc016a45 100644 --- a/include/spdlog/sinks/null_sink.h +++ b/include/spdlog/sinks/null_sink.h @@ -3,9 +3,9 @@ #pragma once -#include -#include -#include +#include "../details/null_mutex.h" +#include "../details/synchronous_factory.h" +#include "base_sink.h" #include diff --git a/include/spdlog/sinks/ostream_sink.h b/include/spdlog/sinks/ostream_sink.h index 6af9dd09..041a8821 100644 --- a/include/spdlog/sinks/ostream_sink.h +++ b/include/spdlog/sinks/ostream_sink.h @@ -3,8 +3,8 @@ #pragma once -#include -#include +#include "../details/null_mutex.h" +#include "base_sink.h" #include #include diff --git a/include/spdlog/sinks/qt_sinks.h b/include/spdlog/sinks/qt_sinks.h index 830d3727..fd8b0278 100644 --- a/include/spdlog/sinks/qt_sinks.h +++ b/include/spdlog/sinks/qt_sinks.h @@ -12,10 +12,10 @@ // QObject, and then use a standard signal/slot. // -#include "spdlog/common.h" -#include "spdlog/details/log_msg.h" -#include "spdlog/details/synchronous_factory.h" -#include "spdlog/sinks/base_sink.h" +#include "../common.h" +#include "../details/log_msg.h" +#include "../details/synchronous_factory.h" +#include "base_sink.h" #include #include @@ -225,7 +225,7 @@ protected: std::array colors_; }; -#include "spdlog/details/null_mutex.h" +#include "../details/null_mutex.h" #include using qt_sink_mt = qt_sink; diff --git a/include/spdlog/sinks/ringbuffer_sink.h b/include/spdlog/sinks/ringbuffer_sink.h index 9ce2fc9d..2b64c52f 100644 --- a/include/spdlog/sinks/ringbuffer_sink.h +++ b/include/spdlog/sinks/ringbuffer_sink.h @@ -3,10 +3,10 @@ #pragma once -#include "spdlog/details/circular_q.h" -#include "spdlog/details/log_msg_buffer.h" -#include "spdlog/details/null_mutex.h" -#include "spdlog/sinks/base_sink.h" +#include "base_sink.h" +#include "../details/circular_q.h" +#include "../details/log_msg_buffer.h" +#include "../details/null_mutex.h" #include #include diff --git a/include/spdlog/sinks/rotating_file_sink.h b/include/spdlog/sinks/rotating_file_sink.h index 5ce477cc..31eae472 100644 --- a/include/spdlog/sinks/rotating_file_sink.h +++ b/include/spdlog/sinks/rotating_file_sink.h @@ -3,10 +3,10 @@ #pragma once -#include -#include -#include -#include +#include "../details/file_helper.h" +#include "../details/null_mutex.h" +#include "../details/synchronous_factory.h" +#include "base_sink.h" #include #include diff --git a/include/spdlog/sinks/sink.h b/include/spdlog/sinks/sink.h index 0bd37521..b6a4c5c1 100644 --- a/include/spdlog/sinks/sink.h +++ b/include/spdlog/sinks/sink.h @@ -3,8 +3,8 @@ #pragma once -#include -#include +#include "../details/log_msg.h" +#include "../formatter.h" namespace spdlog { namespace sinks { diff --git a/include/spdlog/sinks/stdout_color_sinks.h b/include/spdlog/sinks/stdout_color_sinks.h index 5b674119..79ae4ddf 100644 --- a/include/spdlog/sinks/stdout_color_sinks.h +++ b/include/spdlog/sinks/stdout_color_sinks.h @@ -4,13 +4,13 @@ #pragma once #ifdef _WIN32 - #include + #include "wincolor_sink.h" #else - #include + #include "ansicolor_sink.h" #endif -#include -#include +#include "../async.h" +#include "../details/synchronous_factory.h" namespace spdlog { namespace sinks { diff --git a/include/spdlog/sinks/stdout_sinks.h b/include/spdlog/sinks/stdout_sinks.h index 64b487ab..8dd59058 100644 --- a/include/spdlog/sinks/stdout_sinks.h +++ b/include/spdlog/sinks/stdout_sinks.h @@ -3,13 +3,14 @@ #pragma once +#include "../details/console_globals.h" +#include "../details/synchronous_factory.h" +#include "sink.h" + #include -#include -#include -#include #ifdef _WIN32 - #include + #include "../details/windows_include.h" #endif namespace spdlog { diff --git a/include/spdlog/sinks/syslog_sink.h b/include/spdlog/sinks/syslog_sink.h index 87cac33a..5b1d2818 100644 --- a/include/spdlog/sinks/syslog_sink.h +++ b/include/spdlog/sinks/syslog_sink.h @@ -3,9 +3,9 @@ #pragma once -#include -#include -#include +#include "../details/null_mutex.h" +#include "../details/synchronous_factory.h" +#include "base_sink.h" #include #include diff --git a/include/spdlog/sinks/systemd_sink.h b/include/spdlog/sinks/systemd_sink.h index 17f36445..fcf52346 100644 --- a/include/spdlog/sinks/systemd_sink.h +++ b/include/spdlog/sinks/systemd_sink.h @@ -3,10 +3,10 @@ #pragma once -#include -#include -#include -#include +#include "../details/null_mutex.h" +#include "../details/os.h" +#include "../details/synchronous_factory.h" +#include "base_sink.h" #include #ifndef SD_JOURNAL_SUPPRESS_LOCATION diff --git a/include/spdlog/sinks/tcp_sink.h b/include/spdlog/sinks/tcp_sink.h index 25349645..65e3e19f 100644 --- a/include/spdlog/sinks/tcp_sink.h +++ b/include/spdlog/sinks/tcp_sink.h @@ -3,13 +3,13 @@ #pragma once -#include -#include -#include +#include "../common.h" +#include "../details/null_mutex.h" +#include "base_sink.h" #ifdef _WIN32 - #include + #include "../details/tcp_client-windows.h" #else - #include + #include "../details/tcp_client.h" #endif #include diff --git a/include/spdlog/sinks/udp_sink.h b/include/spdlog/sinks/udp_sink.h index 4bff0fd2..7780acb1 100644 --- a/include/spdlog/sinks/udp_sink.h +++ b/include/spdlog/sinks/udp_sink.h @@ -3,13 +3,13 @@ #pragma once -#include -#include -#include +#include "../common.h" +#include "../details/null_mutex.h" +#include "base_sink.h" #ifdef _WIN32 - #include + #include "../details/udp_client-windows.h" #else - #include + #include "../details/udp_client.h" #endif #include diff --git a/include/spdlog/sinks/win_eventlog_sink.h b/include/spdlog/sinks/win_eventlog_sink.h index 3507bf2c..c8781099 100644 --- a/include/spdlog/sinks/win_eventlog_sink.h +++ b/include/spdlog/sinks/win_eventlog_sink.h @@ -32,11 +32,12 @@ Windows Registry Editor Version 5.00 -----------------------------------------------------------------------------------------*/ #pragma once +#ifdef _WIN32 -#include -#include +#include "../details/null_mutex.h" +#include "base_sink.h" -#include +#include "../details/windows_include.h" #include #include @@ -249,3 +250,5 @@ using win_eventlog_sink_st = win_eventlog::win_eventlog_sink -#include -#include -#include +#include "../common.h" +#include "../details/console_globals.h" +#include "../details/null_mutex.h" +#include "sink.h" #include #include diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 8bf85e35..62af1100 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -47,7 +47,9 @@ set(SPDLOG_UTESTS_SOURCES test_circular_q.cpp test_ringbuffer_sink.cpp test_source_location.cpp - test_log_level.cpp) + test_log_level.cpp + test_include_sinks.cpp +) if(NOT SPDLOG_NO_EXCEPTIONS) list(APPEND SPDLOG_UTESTS_SOURCES test_errors.cpp) diff --git a/tests/test_include_sinks.cpp b/tests/test_include_sinks.cpp new file mode 100644 index 00000000..adff1864 --- /dev/null +++ b/tests/test_include_sinks.cpp @@ -0,0 +1,22 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include