23 [[nodiscard]] std::size_t
currentSize() const noexcept {
return _currentSize; }
24 [[nodiscard]] std::size_t
maxSize() const noexcept {
return _maxSize; }
25 [[nodiscard]] std::size_t
maxFiles() const noexcept {
return _maxFiles; }
32 void rotate() noexcept;
33 [[nodiscard]] std::
string backupPath(std::
size_t index) const;
35 std::
string _baseFilepath;
38 std::
size_t _maxFiles;
39 std::
size_t _currentSize = 0;
40 bool _rotationFailureReported = false;
Base class for sinks: handles the level, the pattern and the locking.
Definition ASink.hpp:17
Writes to a file and rotates it when it grows too large.
Definition RotatingFileSink.hpp:13
void flushSink() override
Flushes the output; called with the sink mutex locked.
static constexpr std::size_t DEFAULT_MAX_FILES
Definition RotatingFileSink.hpp:16
~RotatingFileSink() override
std::size_t currentSize() const noexcept
Definition RotatingFileSink.hpp:23
void log(const LogMessage &message) override
Writes one message; called with the sink mutex locked.
std::size_t maxFiles() const noexcept
Definition RotatingFileSink.hpp:25
std::size_t maxSize() const noexcept
Definition RotatingFileSink.hpp:24
static constexpr std::size_t DEFAULT_MAX_SIZE
Definition RotatingFileSink.hpp:15
RotatingFileSink(std::string_view filepath, std::size_t maxSize=DEFAULT_MAX_SIZE, std::size_t maxFiles=DEFAULT_MAX_FILES)
Starts a new file past maxSize bytes, keeping maxFiles backups; <filepath>.1.log is the newest.
Thread-safe logging: loggers, sinks, patterns and macros.
Definition Terminal.hpp:8
A log record as passed to the sinks.
Definition LogMessage.hpp:18