Logger class
#include <Core/Logger.h>
Logger enqueues trace items for processing.
This class should not usually be used directly.
Constructors, destructors, conversion operators
Public functions
- auto operator=(Logger const&) -> Logger& deleted
- void AttachSink(ITraceSink* sink)
- Registers the sink.
- void RemoveSink(ITraceSink* sink)
- Unregisters the sink.
-
auto Write(TraceLevel level,
const char* functionName,
const char* message,
std::
uint32_t messageLength) -> bool - Writes the specified entry to all sinks.
-
void Flush(std::
uint32_t sleepDurationNs = 100) noexcept - Flushes and waits until all prior entries are written to all sinks.
-
void InitializeBacktrace(std::
uint32_t capacity, TraceLevel flushLevel = TraceLevel:: Unknown) - Initializes backtrace storage to be able to use TraceLevel::
Deferred. - void FlushBacktraceAsync() noexcept
- Writes any stored deferred entries to all sinks asynchronously.
-
void ShrinkThreadLocalQueue(std::
size_t capacity) noexcept - Shrinks the thread-local queue to the specified target capacity.
-
auto GetThreadLocalQueueCapacity() -> std::
size_t noexcept - Returns the current capacity of the thread-local queue.
Function documentation
void Death:: Trace:: Logger:: AttachSink(ITraceSink* sink)
Registers the sink.
The sink receives every entry logged after it returns. It must not be called from a sink callback.
void Death:: Trace:: Logger:: RemoveSink(ITraceSink* sink)
Unregisters the sink.
The sink still receives every entry logged before, and once it returns, the sink is no longer called. It waits for the background worker, so it must not be called from a sink callback, or from a thread that a sink callback blocks on, e.g. by invoking synchronously on the UI thread.