From c4a0737ae88b77a2f974615275b49edd4a10ec01 Mon Sep 17 00:00:00 2001 From: Dmitriy Khaustov aka xDimon Date: Mon, 28 Oct 2024 12:28:34 +0300 Subject: [PATCH 1/2] feature: execute rotate on each sink Signed-off-by: Dmitriy Khaustov aka xDimon --- include/soralog/logging_system.hpp | 5 +++++ src/logging_system.cpp | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/include/soralog/logging_system.hpp b/include/soralog/logging_system.hpp index 55164fd..f26fdc3 100644 --- a/include/soralog/logging_system.hpp +++ b/include/soralog/logging_system.hpp @@ -225,6 +225,11 @@ namespace soralog { */ bool resetLevelOfLogger(const std::string &logger_name); + /** + * Calls `Sink::rotate()` for all registered sinks + */ + void callRotateForAllSinks(); + private: /** * @returns loggers (with creating that if it isn't exists yet) with diff --git a/src/logging_system.cpp b/src/logging_system.cpp index 6a4b8e5..7512d96 100644 --- a/src/logging_system.cpp +++ b/src/logging_system.cpp @@ -556,4 +556,12 @@ namespace soralog { return false; } + void LoggingSystem::callRotateForAllSinks() { + std::lock_guard guard(mutex_); + std::ranges::for_each(sinks_, [](const auto &it) { + const auto &sink = it.second; + sink->rotate(); + }); + } + } // namespace soralog From cc64a557062dc7c4c0a6b3028968b461e97b75ba Mon Sep 17 00:00:00 2001 From: Dmitriy Khaustov aka xDimon Date: Mon, 28 Oct 2024 12:36:27 +0300 Subject: [PATCH 2/2] update: bump version Signed-off-by: Dmitriy Khaustov aka xDimon --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 47a3280..38a9fb7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ cmake_minimum_required(VERSION 3.12) include("cmake/Hunter/init.cmake") cmake_policy(SET CMP0048 NEW) -project(soralog VERSION 0.2.2 LANGUAGES CXX) +project(soralog VERSION 0.2.4 LANGUAGES CXX) find_program(CCACHE_FOUND ccache) if (CCACHE_FOUND)