9#ifndef AVARA3D_LOG_SINK_FILELOGSINK_H
10#define AVARA3D_LOG_SINK_FILELOGSINK_H
19#include "a3d/log/sink/LogSink.h"
70 void write(
const std::string& output, Level level)
override;
78 static constexpr unsigned DEFAULT_MAX_FILES = 5;
79 static constexpr unsigned DEFAULT_MAX_FILESIZE = 1024 * 1024 * 1;
89 std::filesystem::path _filepath;
92 std::shared_ptr<std::ofstream> _fileStream;
LogSink that appends output to a file and rotates older files by size.
FileLogSink(const std::filesystem::path &relPath, int maxFiles=DEFAULT_MAX_FILES, int maxFilesize=DEFAULT_MAX_FILESIZE)
Creates an append-mode file sink with size-based rotation.
int maxFilesize() const
Returns the configured rotation size threshold in bytes.
void flush() override
Flushes buffered output to the active file.
void write(const std::string &output, Level level) override
Appends output to the active file and performs size-based rotation when needed.
int maxFiles() const
Returns the configured maximum number of retained log files.
const std::filesystem::path & filepath() const
Returns the path of the active log file.
Interface for destinations that receive formatted Log output.