Core: add configurable startup log rotation
This commit is contained in:
1 parent
a277f2102b
commit
9637f1eef7
9 files changed
+361
-27
No files matched your search
@@ -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;
|
||||
|
||||
@@ -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
|
||||
Reference in new issue
Block a user