From e06f619c9a2de12f561eff3c27beaba532235a0f Mon Sep 17 00:00:00 2001 From: Aster Seker Date: Mon, 7 Sep 2026 18:57:33 +0300 Subject: [PATCH 1/4] fix: expose queue policy as public API Remove the unused DropOldest slow-path option and publish QueuePolicy through a stable header and logging macros. Add an include-contract test for the public queue policy type. --- CMakeLists.txt | 5 ----- include/logit_cpp/logit.hpp | 1 + include/logit_cpp/logit/QueuePolicy.hpp | 14 ++++++++++++++ include/logit_cpp/logit/log_macros.hpp | 6 +++--- include/logit_cpp/logit/loggers.hpp | 1 + tests/CMakeLists.txt | 1 + tests/include_queue_policy_nhr_test.cpp | 6 ++++++ 7 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 include/logit_cpp/logit/QueuePolicy.hpp create mode 100644 tests/include_queue_policy_nhr_test.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 74446e5..7ecf3bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten") endif() option(LOGIT_FORCE_ASYNC_OFF "Force disable async logging" OFF) option(LOGIT_USE_MPSC_RING "Enable lock-free TaskExecutor queue" ON) -option(LOGIT_ENABLE_DROP_OLDEST_SLOWPATH "Enable TaskExecutor DropOldest slow-path" ON) if(NOT DEFINED CMAKE_CXX_STANDARD) if(LOGIT_WITH_OTLP OR LOGIT_WITH_PROMETHEUS_SERVER OR LOGIT_WITH_MDBX) @@ -63,10 +62,6 @@ if(LOGIT_USE_MPSC_RING) target_compile_definitions(log-it-cpp INTERFACE LOGIT_USE_MPSC_RING=1) endif() -if(LOGIT_ENABLE_DROP_OLDEST_SLOWPATH) - target_compile_definitions(log-it-cpp INTERFACE LOGIT_ENABLE_DROP_OLDEST_SLOWPATH=1) -endif() - if(LOGIT_EMSCRIPTEN) set(LOGIT_WITH_SYSLOG OFF CACHE BOOL "" FORCE) set(LOGIT_WITH_WIN_EVENT_LOG OFF CACHE BOOL "" FORCE) diff --git a/include/logit_cpp/logit.hpp b/include/logit_cpp/logit.hpp index a87391f..241487d 100644 --- a/include/logit_cpp/logit.hpp +++ b/include/logit_cpp/logit.hpp @@ -11,6 +11,7 @@ #include "logit/config.hpp" #include "logit/enums.hpp" +#include "logit/QueuePolicy.hpp" #include "logit/utils.hpp" #include "logit/formatter.hpp" #include "logit/loggers.hpp" diff --git a/include/logit_cpp/logit/QueuePolicy.hpp b/include/logit_cpp/logit/QueuePolicy.hpp new file mode 100644 index 0000000..946b7d0 --- /dev/null +++ b/include/logit_cpp/logit/QueuePolicy.hpp @@ -0,0 +1,14 @@ +#pragma once +#ifndef LOGIT_CPP_HEADER_LOGIT_CPP_LOGIT_QUEUEPOLICY_HPP_INCLUDED +#define LOGIT_CPP_HEADER_LOGIT_CPP_LOGIT_QUEUEPOLICY_HPP_INCLUDED + +#include "detail/QueuePolicy.hpp" + +namespace logit { + + /// \brief Public queue overflow handling policy. + using QueuePolicy = detail::QueuePolicy; + +} // namespace logit + +#endif // LOGIT_CPP_HEADER_LOGIT_CPP_LOGIT_QUEUEPOLICY_HPP_INCLUDED diff --git a/include/logit_cpp/logit/log_macros.hpp b/include/logit_cpp/logit/log_macros.hpp index e2cfe0a..39635b6 100644 --- a/include/logit_cpp/logit/log_macros.hpp +++ b/include/logit_cpp/logit/log_macros.hpp @@ -2928,16 +2928,16 @@ static_assert(LOGIT_LEVEL_FATAL == static_cast(logit::LogLevel::LOG_LVL_FAT logit::detail::TaskExecutor::get_instance().set_max_queue_size(size) /// \brief Queue policy for dropping the newest task when the queue is full. -#define LOGIT_QUEUE_DROP_NEWEST logit::detail::QueuePolicy::DropNewest +#define LOGIT_QUEUE_DROP_NEWEST logit::QueuePolicy::DropNewest /// \brief Queue policy for dropping the oldest task when the queue is full. -#define LOGIT_QUEUE_DROP_OLDEST logit::detail::QueuePolicy::DropOldest +#define LOGIT_QUEUE_DROP_OLDEST logit::QueuePolicy::DropOldest /// \brief Backward-compatible alias for dropping the newest task. #define LOGIT_QUEUE_DROP LOGIT_QUEUE_DROP_NEWEST /// \brief Queue policy for blocking when the queue is full. -#define LOGIT_QUEUE_BLOCK logit::detail::QueuePolicy::Block +#define LOGIT_QUEUE_BLOCK logit::QueuePolicy::Block /// \brief Sets the behavior when the queue is full. /// \param mode LOGIT_QUEUE_DROP_NEWEST, LOGIT_QUEUE_DROP_OLDEST or LOGIT_QUEUE_BLOCK. diff --git a/include/logit_cpp/logit/loggers.hpp b/include/logit_cpp/logit/loggers.hpp index 2c6bd86..cd7deb1 100644 --- a/include/logit_cpp/logit/loggers.hpp +++ b/include/logit_cpp/logit/loggers.hpp @@ -10,6 +10,7 @@ /// any header under `loggers/` to satisfy the nearest-header requirement. #include "config.hpp" +#include "QueuePolicy.hpp" #include "utils.hpp" #include "detail/TaskExecutor.hpp" #include "detail/SingleThreadExecutor.hpp" diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 3c904e2..f8a1845 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -40,6 +40,7 @@ else() include_log_file_read_result_nhr_test.cpp include_loggers_nhr_test.cpp include_memory_logger_nhr_test.cpp + include_queue_policy_nhr_test.cpp include_only_ilogger_test.cpp include_quickstart_test.cpp include_utils_nhr_test.cpp diff --git a/tests/include_queue_policy_nhr_test.cpp b/tests/include_queue_policy_nhr_test.cpp new file mode 100644 index 0000000..6ced69b --- /dev/null +++ b/tests/include_queue_policy_nhr_test.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + logit::QueuePolicy policy = logit::QueuePolicy::Block; + return policy == logit::QueuePolicy::Block ? 0 : 1; +} From 1b20da3e176e68c380eebb188afc3682bd34c0bc Mon Sep 17 00:00:00 2001 From: Aster Seker Date: Tue, 8 Sep 2026 19:56:40 +0300 Subject: [PATCH 2/4] fix: align queue policy with aggregate-first headers Keep QueuePolicy owned by the loggers module umbrella and expose it through the unified public entry point. Remove the standalone leaf header and include-contract test so the documented header policy does not promise unsupported direct inclusion. --- include/logit_cpp/logit.hpp | 1 - include/logit_cpp/logit/QueuePolicy.hpp | 14 -------------- include/logit_cpp/logit/loggers.hpp | 9 ++++++++- tests/CMakeLists.txt | 1 - tests/include_queue_policy_nhr_test.cpp | 6 ------ 5 files changed, 8 insertions(+), 23 deletions(-) delete mode 100644 include/logit_cpp/logit/QueuePolicy.hpp delete mode 100644 tests/include_queue_policy_nhr_test.cpp diff --git a/include/logit_cpp/logit.hpp b/include/logit_cpp/logit.hpp index 241487d..a87391f 100644 --- a/include/logit_cpp/logit.hpp +++ b/include/logit_cpp/logit.hpp @@ -11,7 +11,6 @@ #include "logit/config.hpp" #include "logit/enums.hpp" -#include "logit/QueuePolicy.hpp" #include "logit/utils.hpp" #include "logit/formatter.hpp" #include "logit/loggers.hpp" diff --git a/include/logit_cpp/logit/QueuePolicy.hpp b/include/logit_cpp/logit/QueuePolicy.hpp deleted file mode 100644 index 946b7d0..0000000 --- a/include/logit_cpp/logit/QueuePolicy.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once -#ifndef LOGIT_CPP_HEADER_LOGIT_CPP_LOGIT_QUEUEPOLICY_HPP_INCLUDED -#define LOGIT_CPP_HEADER_LOGIT_CPP_LOGIT_QUEUEPOLICY_HPP_INCLUDED - -#include "detail/QueuePolicy.hpp" - -namespace logit { - - /// \brief Public queue overflow handling policy. - using QueuePolicy = detail::QueuePolicy; - -} // namespace logit - -#endif // LOGIT_CPP_HEADER_LOGIT_CPP_LOGIT_QUEUEPOLICY_HPP_INCLUDED diff --git a/include/logit_cpp/logit/loggers.hpp b/include/logit_cpp/logit/loggers.hpp index cd7deb1..f4740bd 100644 --- a/include/logit_cpp/logit/loggers.hpp +++ b/include/logit_cpp/logit/loggers.hpp @@ -10,10 +10,17 @@ /// any header under `loggers/` to satisfy the nearest-header requirement. #include "config.hpp" -#include "QueuePolicy.hpp" #include "utils.hpp" #include "detail/TaskExecutor.hpp" #include "detail/SingleThreadExecutor.hpp" + +namespace logit { + + /// \brief Public queue overflow handling policy. + using QueuePolicy = detail::QueuePolicy; + +} // namespace logit + #ifndef __EMSCRIPTEN__ #include "detail/CompressionWorker.hpp" #endif diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f8a1845..3c904e2 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -40,7 +40,6 @@ else() include_log_file_read_result_nhr_test.cpp include_loggers_nhr_test.cpp include_memory_logger_nhr_test.cpp - include_queue_policy_nhr_test.cpp include_only_ilogger_test.cpp include_quickstart_test.cpp include_utils_nhr_test.cpp diff --git a/tests/include_queue_policy_nhr_test.cpp b/tests/include_queue_policy_nhr_test.cpp deleted file mode 100644 index 6ced69b..0000000 --- a/tests/include_queue_policy_nhr_test.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main() { - logit::QueuePolicy policy = logit::QueuePolicy::Block; - return policy == logit::QueuePolicy::Block ? 0 : 1; -} From ea861e9824aec1dba60f02d745d60b2c987cc3ad Mon Sep 17 00:00:00 2001 From: Aster Seker Date: Tue, 8 Sep 2026 19:58:46 +0300 Subject: [PATCH 3/4] test: cover queue policy through logger umbrella Verify that the supported logit/loggers.hpp entry point exports the public QueuePolicy alias without requiring a standalone leaf header. --- tests/include_loggers_nhr_test.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/include_loggers_nhr_test.cpp b/tests/include_loggers_nhr_test.cpp index 4002c8d..2f45b97 100644 --- a/tests/include_loggers_nhr_test.cpp +++ b/tests/include_loggers_nhr_test.cpp @@ -2,8 +2,9 @@ #include int main() { + const logit::QueuePolicy policy = logit::QueuePolicy::Block; logit::ConsoleLogger logger(false); logger.set_log_level(logit::LogLevel::LOG_LVL_WARN); logger.wait(); - return 0; + return policy == logit::QueuePolicy::Block ? 0 : 1; } From 4b50cc1b56bb8757ccb11365b4f306378b3ef710 Mon Sep 17 00:00:00 2001 From: Aster Seker Date: Tue, 8 Sep 2026 20:45:31 +0300 Subject: [PATCH 4/4] fix: present queue policy as public API Use the public QueuePolicy alias in logger configuration and constructor signatures while keeping the underlying enum implementation-owned. Clarify the aggregate-first header contract, document MPSC DropOldest semantics, and fix the queue policy example indentation. --- include/logit_cpp/AGENTS.md | 8 ++++++-- include/logit_cpp/logit/detail/QueuePolicy.hpp | 3 ++- .../logit_cpp/logit/loggers/ConsoleLogger.hpp | 8 ++++---- .../logit_cpp/logit/loggers/EventLogLogger.hpp | 10 +++++----- include/logit_cpp/logit/loggers/FileLogger.hpp | 16 ++++++++-------- include/logit_cpp/logit/loggers/SyslogLogger.hpp | 10 +++++----- .../logit_cpp/logit/loggers/UniqueFileLogger.hpp | 12 ++++++------ .../logit/loggers/WindowsDebugLogger.hpp | 10 +++++----- 8 files changed, 41 insertions(+), 36 deletions(-) diff --git a/include/logit_cpp/AGENTS.md b/include/logit_cpp/AGENTS.md index f7d4d8b..747628a 100644 --- a/include/logit_cpp/AGENTS.md +++ b/include/logit_cpp/AGENTS.md @@ -23,8 +23,12 @@ For subsystem-specific work, also read the nearest guide: normally consumed through `` or the relevant module umbrella. - Preserve the existing public names, overloads, macro expansion contracts, and feature guards. Add new API only with a focused test and documentation. -- Keep headers self-contained: include every standard type used directly and - do not depend on include order or transitive headers. +- Keep the supported public umbrellas (`logit.hpp`, `utils.hpp`, + `formatter.hpp`, `loggers.hpp`) self-contained. +- Leaf headers follow the aggregate-first/NHR contract and may rely on + prerequisites prepared by their nearest umbrella. Do not add standalone + include contracts to leaf headers unless explicitly required by the public + API and covered by a focused test. - A `noexcept` declaration is a contract. Do not perform allocation, invoke a user callback, or execute code that may throw in a `noexcept` function. Signal/crash handlers are the explicit exception and must stay async-signal diff --git a/include/logit_cpp/logit/detail/QueuePolicy.hpp b/include/logit_cpp/logit/detail/QueuePolicy.hpp index a1ecf50..e5ab7ac 100644 --- a/include/logit_cpp/logit/detail/QueuePolicy.hpp +++ b/include/logit_cpp/logit/detail/QueuePolicy.hpp @@ -7,7 +7,8 @@ namespace logit { namespace detail { /// \brief Queue overflow handling policy used by TaskExecutor and SingleThreadExecutor. enum class QueuePolicy { DropNewest, ///< Reject the incoming task when the queue is full. - DropOldest, ///< Drop the oldest queued task. + DropOldest, ///< Drop-oldest policy; MPSC mode rejects the incoming task + ///< to preserve the ordering of already accepted work. Block ///< Producers wait until capacity is available. }; diff --git a/include/logit_cpp/logit/loggers/ConsoleLogger.hpp b/include/logit_cpp/logit/loggers/ConsoleLogger.hpp index 34c39f8..68666bb 100644 --- a/include/logit_cpp/logit/loggers/ConsoleLogger.hpp +++ b/include/logit_cpp/logit/loggers/ConsoleLogger.hpp @@ -83,7 +83,7 @@ namespace logit { #endif bool use_dedicated_executor = false; ///< Use a dedicated executor instead of the global TaskExecutor; native builds create one worker thread per logger. std::size_t queue_capacity = 0; ///< Maximum queue size for the dedicated executor (0 = unlimited). - detail::QueuePolicy queue_policy = detail::QueuePolicy::Block; ///< Overflow policy for the dedicated executor. + QueuePolicy queue_policy = QueuePolicy::Block; ///< Overflow policy for the dedicated executor. /// \brief Optional level-based stream routing. /// \details When non-empty, the first matching route (inclusive range /// `[min_level, max_level]`) wins. Falls back to the primary stream when @@ -140,7 +140,7 @@ namespace logit { bool async, bool use_dedicated_executor, std::size_t queue_capacity = 0, - detail::QueuePolicy queue_policy = detail::QueuePolicy::Block) + QueuePolicy queue_policy = QueuePolicy::Block) : ConsoleLogger(make_config( async, use_dedicated_executor, @@ -153,7 +153,7 @@ namespace logit { bool async, bool use_dedicated_executor, std::size_t queue_capacity = 0, - detail::QueuePolicy queue_policy = detail::QueuePolicy::Block) + QueuePolicy queue_policy = QueuePolicy::Block) : ConsoleLogger(stream, make_config( async, use_dedicated_executor, @@ -429,7 +429,7 @@ namespace logit { bool async, bool use_dedicated_executor, std::size_t queue_capacity, - detail::QueuePolicy queue_policy) { + QueuePolicy queue_policy) { Config config; config.async = async; config.use_dedicated_executor = use_dedicated_executor; diff --git a/include/logit_cpp/logit/loggers/EventLogLogger.hpp b/include/logit_cpp/logit/loggers/EventLogLogger.hpp index 5d0f649..9e53692 100644 --- a/include/logit_cpp/logit/loggers/EventLogLogger.hpp +++ b/include/logit_cpp/logit/loggers/EventLogLogger.hpp @@ -33,7 +33,7 @@ namespace logit { bool async; ///< Use TaskExecutor when true. bool use_dedicated_executor = false; ///< Use a dedicated executor instead of the global TaskExecutor; native builds create one worker thread per logger. std::size_t queue_capacity = 0; ///< Maximum queue size for the dedicated executor (0 = unlimited). - detail::QueuePolicy queue_policy = detail::QueuePolicy::Block; ///< Overflow policy for the dedicated executor. + QueuePolicy queue_policy = QueuePolicy::Block; ///< Overflow policy for the dedicated executor. /// \brief Initialize configuration. /// \param s Source name. /// \param a Run asynchronously. @@ -66,7 +66,7 @@ namespace logit { bool async, bool use_dedicated_executor, std::size_t queue_capacity, - detail::QueuePolicy queue_policy) + QueuePolicy queue_policy) : EventLogLogger(make_config( source, async, @@ -164,7 +164,7 @@ namespace logit { bool async, bool use_dedicated_executor, std::size_t queue_capacity, - detail::QueuePolicy queue_policy) { + QueuePolicy queue_policy) { Config config(source, async); config.use_dedicated_executor = use_dedicated_executor; config.queue_capacity = queue_capacity; @@ -184,7 +184,7 @@ namespace logit { bool async; ///< Unused flag. bool use_dedicated_executor = false; ///< Unused flag. std::size_t queue_capacity = 0; ///< Unused. - detail::QueuePolicy queue_policy = detail::QueuePolicy::Block; ///< Unused. + QueuePolicy queue_policy = QueuePolicy::Block; ///< Unused. Config(const wchar_t* s = L"", bool a = false) : source(s), async(a) {} }; @@ -202,7 +202,7 @@ namespace logit { /// \brief Construct with parameters and ignored dedicated executor options. EventLogLogger(const wchar_t* source, bool async, bool use_dedicated_executor, - std::size_t queue_capacity, detail::QueuePolicy queue_policy) { + std::size_t queue_capacity, QueuePolicy queue_policy) { (void)source; (void)async; (void)use_dedicated_executor; (void)queue_capacity; (void)queue_policy; } diff --git a/include/logit_cpp/logit/loggers/FileLogger.hpp b/include/logit_cpp/logit/loggers/FileLogger.hpp index 9a3cfe6..1b4f7bf 100644 --- a/include/logit_cpp/logit/loggers/FileLogger.hpp +++ b/include/logit_cpp/logit/loggers/FileLogger.hpp @@ -43,7 +43,7 @@ namespace logit { uint32_t seq_width = 3; bool use_dedicated_executor = false; std::size_t queue_capacity = 0; - detail::QueuePolicy queue_policy = detail::QueuePolicy::Block; + QueuePolicy queue_policy = QueuePolicy::Block; }; FileLogger() { warn(); } @@ -51,9 +51,9 @@ namespace logit { FileLogger(const std::string&, const bool& = true, const int& = 30, const uint64_t& = 0, const uint32_t& = 0) { warn(); } FileLogger(const std::string&, const bool&, const int&, bool, std::size_t, - detail::QueuePolicy) { warn(); } + QueuePolicy) { warn(); } FileLogger(const std::string&, const bool&, const int&, uint64_t, uint32_t, - bool, std::size_t, detail::QueuePolicy) { warn(); } + bool, std::size_t, QueuePolicy) { warn(); } void log(const LogRecord&, const std::string&) override { warn(); } std::string get_string_param(const LoggerParam&) const override { return {}; } @@ -106,7 +106,7 @@ namespace logit { uint32_t seq_width = 3; ///< Width of sequence index. bool use_dedicated_executor = false; ///< Use a dedicated executor instead of the global TaskExecutor; native builds create one worker thread per logger. std::size_t queue_capacity = 0; ///< Maximum queue size for the dedicated executor (0 = unlimited). - detail::QueuePolicy queue_policy = detail::QueuePolicy::Block; ///< Overflow policy for the dedicated executor. + QueuePolicy queue_policy = QueuePolicy::Block; ///< Overflow policy for the dedicated executor. }; /// \brief Default constructor that uses default configuration. @@ -146,7 +146,7 @@ namespace logit { const int& auto_delete_days, bool use_dedicated_executor, std::size_t queue_capacity, - detail::QueuePolicy queue_policy) + QueuePolicy queue_policy) : FileLogger(make_config( directory, async, @@ -181,7 +181,7 @@ namespace logit { uint32_t max_rotated_files, bool use_dedicated_executor, std::size_t queue_capacity, - detail::QueuePolicy queue_policy) + QueuePolicy queue_policy) : FileLogger(make_config( directory, async, @@ -255,7 +255,7 @@ namespace logit { /// changes async mode or executor ownership. If no dedicated executor exists, /// only the stored config fields are updated for future reference. bool set_queue_config(std::size_t queue_capacity, - detail::QueuePolicy queue_policy) { + QueuePolicy queue_policy) { std::lock_guard lifecycle_lock(m_lifecycle_mutex); if (m_shutdown.load(std::memory_order_acquire)) { @@ -563,7 +563,7 @@ namespace logit { uint32_t max_rotated_files, bool use_dedicated_executor, std::size_t queue_capacity, - detail::QueuePolicy queue_policy) { + QueuePolicy queue_policy) { Config config; config.directory = directory; config.async = async; diff --git a/include/logit_cpp/logit/loggers/SyslogLogger.hpp b/include/logit_cpp/logit/loggers/SyslogLogger.hpp index 924cfa0..7fb0595 100644 --- a/include/logit_cpp/logit/loggers/SyslogLogger.hpp +++ b/include/logit_cpp/logit/loggers/SyslogLogger.hpp @@ -34,7 +34,7 @@ namespace logit { bool async; ///< Use TaskExecutor when true. bool use_dedicated_executor = false; ///< Use a dedicated executor instead of the global TaskExecutor; native builds create one worker thread per logger. std::size_t queue_capacity = 0; ///< Maximum queue size for the dedicated executor (0 = unlimited). - detail::QueuePolicy queue_policy = detail::QueuePolicy::Block; ///< Overflow policy for the dedicated executor. + QueuePolicy queue_policy = QueuePolicy::Block; ///< Overflow policy for the dedicated executor. /// \brief Initialize configuration. /// \param i Identifier string. /// \param f Facility code. @@ -71,7 +71,7 @@ namespace logit { bool async, bool use_dedicated_executor, std::size_t queue_capacity, - detail::QueuePolicy queue_policy) + QueuePolicy queue_policy) : SyslogLogger(make_config( ident, facility, @@ -163,7 +163,7 @@ namespace logit { bool async, bool use_dedicated_executor, std::size_t queue_capacity, - detail::QueuePolicy queue_policy) { + QueuePolicy queue_policy) { Config config(ident, facility, async); config.use_dedicated_executor = use_dedicated_executor; config.queue_capacity = queue_capacity; @@ -184,7 +184,7 @@ namespace logit { bool async; ///< Unused flag. bool use_dedicated_executor = false; ///< Unused flag. std::size_t queue_capacity = 0; ///< Unused. - detail::QueuePolicy queue_policy = detail::QueuePolicy::Block; ///< Unused. + QueuePolicy queue_policy = QueuePolicy::Block; ///< Unused. Config(const char* i="", int f=0, bool a=false) : ident(i), facility(f), async(a) {} }; @@ -203,7 +203,7 @@ namespace logit { /// \brief Construct with parameters and ignored dedicated executor options. SyslogLogger(const char* ident, int facility, bool async, bool use_dedicated_executor, - std::size_t queue_capacity, detail::QueuePolicy queue_policy) { + std::size_t queue_capacity, QueuePolicy queue_policy) { (void)ident; (void)facility; (void)async; (void)use_dedicated_executor; (void)queue_capacity; (void)queue_policy; } diff --git a/include/logit_cpp/logit/loggers/UniqueFileLogger.hpp b/include/logit_cpp/logit/loggers/UniqueFileLogger.hpp index 8249fd2..7a1d20a 100644 --- a/include/logit_cpp/logit/loggers/UniqueFileLogger.hpp +++ b/include/logit_cpp/logit/loggers/UniqueFileLogger.hpp @@ -34,14 +34,14 @@ namespace logit { size_t hash_length = 8; bool use_dedicated_executor = false; std::size_t queue_capacity = 0; - detail::QueuePolicy queue_policy = detail::QueuePolicy::Block; + QueuePolicy queue_policy = QueuePolicy::Block; }; UniqueFileLogger() { warn(); } UniqueFileLogger(const Config&) { warn(); } UniqueFileLogger(const std::string&, bool = true, int = 30, size_t = 8) { warn(); } UniqueFileLogger(const std::string&, bool, int, size_t, bool, std::size_t, - detail::QueuePolicy) { warn(); } + QueuePolicy) { warn(); } void log(const LogRecord&, const std::string&) override { warn(); } std::string get_string_param(const LoggerParam&) const override { return {}; } @@ -88,7 +88,7 @@ namespace logit { size_t hash_length = 8; ///< Length of the hash used in filenames. bool use_dedicated_executor = false; ///< Use a dedicated executor instead of the global TaskExecutor; native builds create one worker thread per logger. std::size_t queue_capacity = 0; ///< Maximum queue size for the dedicated executor (0 = unlimited). - detail::QueuePolicy queue_policy = detail::QueuePolicy::Block; ///< Overflow policy for the dedicated executor. + QueuePolicy queue_policy = QueuePolicy::Block; ///< Overflow policy for the dedicated executor. }; /// \brief Default constructor that uses default configuration. @@ -132,7 +132,7 @@ namespace logit { size_t hash_length, bool use_dedicated_executor, std::size_t queue_capacity, - detail::QueuePolicy queue_policy) + QueuePolicy queue_policy) : UniqueFileLogger(make_config( directory, async, @@ -199,7 +199,7 @@ namespace logit { /// changes async mode or executor ownership. If no dedicated executor exists, /// only the stored config fields are updated for future reference. bool set_queue_config(std::size_t queue_capacity, - detail::QueuePolicy queue_policy) { + QueuePolicy queue_policy) { std::lock_guard lifecycle_lock(m_lifecycle_mutex); if (m_shutdown.load(std::memory_order_acquire)) { @@ -478,7 +478,7 @@ namespace logit { size_t hash_length, bool use_dedicated_executor, std::size_t queue_capacity, - detail::QueuePolicy queue_policy) { + QueuePolicy queue_policy) { Config config; config.directory = directory; config.async = async; diff --git a/include/logit_cpp/logit/loggers/WindowsDebugLogger.hpp b/include/logit_cpp/logit/loggers/WindowsDebugLogger.hpp index 37f2419..5c91685 100644 --- a/include/logit_cpp/logit/loggers/WindowsDebugLogger.hpp +++ b/include/logit_cpp/logit/loggers/WindowsDebugLogger.hpp @@ -46,12 +46,12 @@ namespace logit { : async(async_value) , use_dedicated_executor(false) , queue_capacity(0) - , queue_policy(detail::QueuePolicy::Block) {} + , queue_policy(QueuePolicy::Block) {} bool async; ///< Flag indicating whether logging should be asynchronous. bool use_dedicated_executor; ///< Use a dedicated executor instead of the global TaskExecutor; native builds create one worker thread per logger. std::size_t queue_capacity; ///< Maximum queue size for the dedicated executor (0 = unlimited). - detail::QueuePolicy queue_policy; ///< Overflow policy for the dedicated executor. + QueuePolicy queue_policy; ///< Overflow policy for the dedicated executor. }; /// \brief Default constructor that uses default configuration. @@ -72,7 +72,7 @@ namespace logit { bool async, bool use_dedicated_executor, std::size_t queue_capacity, - detail::QueuePolicy queue_policy) + QueuePolicy queue_policy) : WindowsDebugLogger(make_config( async, use_dedicated_executor, @@ -126,7 +126,7 @@ namespace logit { /// changes async mode or executor ownership. If no dedicated executor exists, /// only the stored config fields are updated for future reference. bool set_queue_config(std::size_t queue_capacity, - detail::QueuePolicy queue_policy) { + QueuePolicy queue_policy) { std::lock_guard lifecycle_lock(m_lifecycle_mutex); if (m_shutdown.load(std::memory_order_acquire)) { @@ -256,7 +256,7 @@ namespace logit { bool async, bool use_dedicated_executor, std::size_t queue_capacity, - detail::QueuePolicy queue_policy) { + QueuePolicy queue_policy) { Config config(async); config.use_dedicated_executor = use_dedicated_executor; config.queue_capacity = queue_capacity;