Core: add configurable startup log rotation

This commit is contained in:
faumaray committed 2026-07-28 21:10:09 +03:00
1 parent a277f2102b
commit 9637f1eef7
9 files changed
+361 -27

No files matched your search

+2 -1
View File
@@ -187,7 +187,8 @@ namespace Echoion::Core
// Build the console + split-file logging stack and install it as
// the global Void::Log sink (logSink_ must outlive logging).
void installLogging(const std::filesystem::path& logDirectory);
void installLogging(const std::filesystem::path& logDirectory,
const Api::LoggingConfig& config);
// Guard helper: ok if initialized, else a ServiceUnavailable error.
[[nodiscard]] Api::Result<void> requireInitialized() const noexcept;
+15
View File
@@ -0,0 +1,15 @@
#pragma once
#include <cstddef>
#include <filesystem>
#include <system_error>
namespace Echoion::Core
{
// Archive a non-empty active log into <directory>/history and prune the
// oldest archives. This is intentionally performed before opening the
// logger so every process start gets a fresh active file.
[[nodiscard]] std::error_code
rotateLogOnStartup(const std::filesystem::path& activeLog,
std::size_t maxFiles) noexcept;
} // namespace Echoion::Core