Writes one file per run, keeping the files of the previous runs as backups.
More...
#include <RST/log/Sinks/SessionFileSink.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 one file per run, keeping the files of the previous runs as backups.
◆ SessionFileSink()
| RST::Log::SessionFileSink::SessionFileSink |
( |
std::string_view |
filepath, |
|
|
std::size_t |
maxBackups = DEFAULT_MAX_BACKUPS |
|
) |
| |
|
explicit |
Opens filepath, first renaming the file of the previous run to a dated -backup- copy.
Only the maxBackups newest backups are kept.
- Exceptions
-
| std::runtime_error | if the file cannot be opened. |
◆ ~SessionFileSink()
| RST::Log::SessionFileSink::~SessionFileSink |
( |
| ) |
|
|
override |
◆ filepath()
| const std::string & RST::Log::SessionFileSink::filepath |
( |
| ) |
const |
|
inlinenoexcept |
◆ log()
| void RST::Log::SessionFileSink::log |
( |
const LogMessage & |
message | ) |
|
|
overrideprotectedvirtual |
Writes one message; called with the sink mutex locked.
Implements RST::Log::ASink.
◆ flushSink()
| void RST::Log::SessionFileSink::flushSink |
( |
| ) |
|
|
overrideprotectedvirtual |
Flushes the output; called with the sink mutex locked.
Reimplemented from RST::Log::ASink.
◆ DEFAULT_MAX_BACKUPS
| constexpr std::size_t RST::Log::SessionFileSink::DEFAULT_MAX_BACKUPS = 10 |
|
staticconstexpr |
The documentation for this class was generated from the following file: