Add configurable split file logging
This commit is contained in:
3 files changed
+68
-8
No files matched your search
@@ -22,9 +22,8 @@ namespace Void::Logging
|
||||
/// to the per-level files.
|
||||
bool combined = true;
|
||||
std::size_t max_bytes = 1024 * 1024;
|
||||
/// Unused. Rotation here is a synchronized, unbounded history
|
||||
/// (see class comment) rather than a max_files-bounded rotation,
|
||||
/// so this has no effect — kept only for API compatibility.
|
||||
/// Maximum number of synchronized history snapshots retained.
|
||||
/// Zero removes a snapshot immediately after rotation.
|
||||
std::size_t max_files = 5;
|
||||
Mode mode = Mode::Async;
|
||||
std::size_t capacity = 512;
|
||||
@@ -43,8 +42,8 @@ namespace Void::Logging
|
||||
/// ones well under the limit) is moved, under its own name unchanged,
|
||||
/// into `<dir>/history/<creation_time>/`, where `<creation_time>`
|
||||
/// marks when this batch of files started filling up. Fresh, empty
|
||||
/// files then continue at their usual paths. Every snapshot is kept
|
||||
/// indefinitely — see SplitFileOptions::max_files.
|
||||
/// files then continue at their usual paths. The oldest snapshots are
|
||||
/// pruned so at most SplitFileOptions::max_files remain.
|
||||
class SplitFileLogger final : public Logger
|
||||
{
|
||||
public:
|
||||
@@ -91,6 +90,7 @@ namespace Void::Logging
|
||||
/// owned file into a shared history/<creation_time> snapshot
|
||||
/// directory and start each one fresh.
|
||||
void maybe_rotate_group();
|
||||
void prune_history();
|
||||
|
||||
std::filesystem::path m_dir;
|
||||
Options m_options;
|
||||
|
||||
Reference in new issue
Block a user