|
Motion Master 6.0.0-alpha.50
Next-generation motion control software
|
Thread-safe spdlog sink that retains the most recent log entries in memory. More...
#include <ring_log_sink.h>
Public Member Functions | |
| RingLogSink (std::size_t capacity=100000) | |
| Constructs the sink with the given ring-buffer capacity. | |
| std::vector< std::string > | entries () |
| Returns a snapshot of all currently buffered log lines. | |
Protected Member Functions | |
| void | sink_it_ (const spdlog::details::log_msg &msg) override |
| void | flush_ () override |
Thread-safe spdlog sink that retains the most recent log entries in memory.
Stores up to capacity formatted log lines in a ring buffer. Once full the oldest entry is discarded to make room for each new one. entries() returns a snapshot of all buffered lines in chronological order.
Intended use: install alongside the console sink so the HTTP API can serve the in-process log without touching the filesystem.
| Mutex | Mutex type forwarded to spdlog::sinks::base_sink (use std::mutex for multi-threaded sinks). |
|
inlineexplicit |
Constructs the sink with the given ring-buffer capacity.
| capacity | Maximum number of log lines to retain. Defaults to 10 000. |
|
inline |
Returns a snapshot of all currently buffered log lines.
Lines are in chronological order (oldest first). Trailing newlines are stripped so each element is a plain text string suitable for JSON embedding.
Not const because base_sink::mutex_ is not mutable.
|
inlineoverrideprotected |
|
inlineoverrideprotected |