Writes to a file and rotates it when it grows too large.
More...
#include <RST/log/Sinks/RotatingFileSink.hpp>
|
| void | log (const LogMessage &message) override |
| | Writes one message; called with the sink mutex locked.
|
| |
| void | flushSink () override |
| | Flushes the output; called with the sink mutex locked.
|
| |
| std::string_view | formatted (const LogMessage &message) |
| | The message formatted with the sink pattern.
|
| |
| std::mutex & | sinkMutex () noexcept |
| |
Writes to a file and rotates it when it grows too large.
◆ RotatingFileSink()
Starts a new file past maxSize bytes, keeping maxFiles backups; <filepath>.1.log is the newest.
- Exceptions
-
| std::runtime_error | if the file cannot be opened. |
◆ ~RotatingFileSink()
| RST::Log::RotatingFileSink::~RotatingFileSink |
( |
| ) |
|
|
override |
◆ currentSize()
| std::size_t RST::Log::RotatingFileSink::currentSize |
( |
| ) |
const |
|
inlinenoexcept |
◆ maxSize()
| std::size_t RST::Log::RotatingFileSink::maxSize |
( |
| ) |
const |
|
inlinenoexcept |
◆ maxFiles()
| std::size_t RST::Log::RotatingFileSink::maxFiles |
( |
| ) |
const |
|
inlinenoexcept |
◆ log()
| void RST::Log::RotatingFileSink::log |
( |
const LogMessage & |
message | ) |
|
|
overrideprotectedvirtual |
Writes one message; called with the sink mutex locked.
Implements RST::Log::ASink.
◆ flushSink()
| void RST::Log::RotatingFileSink::flushSink |
( |
| ) |
|
|
overrideprotectedvirtual |
Flushes the output; called with the sink mutex locked.
Reimplemented from RST::Log::ASink.
◆ DEFAULT_MAX_SIZE
| constexpr std::size_t RST::Log::RotatingFileSink::DEFAULT_MAX_SIZE = 10 * 1024 * 1024 |
|
staticconstexpr |
◆ DEFAULT_MAX_FILES
| constexpr std::size_t RST::Log::RotatingFileSink::DEFAULT_MAX_FILES = 5 |
|
staticconstexpr |
The documentation for this class was generated from the following file: