QuasarEngine
Cross-platform 3D engine and editor
Loading...
Searching...
No Matches
Quasar::MemoryLogSink Class Referencefinal

Log sink that keeps the most recent messages in memory, so that the console can display them. More...

#include <quasar/core/MemoryLogSink.h>

Inheritance diagram for Quasar::MemoryLogSink:

Public Member Functions

 MemoryLogSink (std::size_t capacity)
 Creates a sink that keeps at most capacity messages. A capacity of 0 keeps one message.
std::vector< LogMessage > GetMessages () const
 Returns a copy of the kept messages, from the oldest to the most recent.
void Clear ()
 Removes every kept message.
std::size_t GetCapacity () const
 Returns the maximum number of messages the sink keeps.

Protected Member Functions

void sink_it_ (const spdlog::details::log_msg &message) override
 Keeps a new message. Called by spdlog for each message written to a logger that uses this sink.
void flush_ () override
 Does nothing: the messages are already in memory.

Detailed Description

Log sink that keeps the most recent messages in memory, so that the console can display them.

The sink keeps at most a given number of messages: when it is full, each new message replaces the oldest one. Messages can be read from any thread, even while other threads are writing new ones.


The documentation for this class was generated from the following file: