Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: mass rotate #36

Merged
merged 2 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions include/soralog/logging_system.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions src/logging_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading