Skip to content

EntropyEngine::Core::Logging::ILogSink

Interface for log sinks that handle log output. More…

#include <ILogSink.h>

Inherited by EntropyEngine::Core::Logging::ConsoleSink

Name
virtual~ILogSink() =default
virtual voidwrite(const LogEntry & entry) =0
Write a log entry to this sink.
virtual boolshouldLog(LogLevel level) const =0
Check if this sink accepts logs at the given level.
virtual voidsetMinLevel(LogLevel level) =0
Set the minimum log level for this sink.
virtual voidflush() =0
Flush any buffered data.
class EntropyEngine::Core::Logging::ILogSink;

Interface for log sinks that handle log output.

Log sinks receive LogEntry objects and output them to their designated destination. Each sink can implement its own formatting, filtering, and delivery mechanisms.

Common sink implementations:

  • Console: Output to stdout/stderr with optional color
  • File: Persistent storage with rotation support
  • Network: Remote logging servers
  • Database: Structured storage for analysis
  • Memory: In-memory ring buffer

Multiple sinks can operate independently with different configurations, allowing flexible log routing based on severity or category.

virtual ~ILogSink() =default
virtual void write(
const LogEntry & entry
) =0

Write a log entry to this sink.

Parameters:

  • entry The log entry to write

Reimplemented by: EntropyEngine::Core::Logging::ConsoleSink::write

Processes and outputs a log entry according to the sink’s implementation. Must be thread-safe. May buffer output for performance.

void MyCustomSink::write(const LogEntry& entry) {
if (!shouldLog(entry.level)) return;
auto formatted = formatEntry(entry);
sendToDestination(formatted);
}
virtual bool shouldLog(
LogLevel level
) const =0

Check if this sink accepts logs at the given level.

Parameters:

  • level The log level to check

Return: true if the sink will process logs at this level

Reimplemented by: EntropyEngine::Core::Logging::ConsoleSink::shouldLog

Allows different sinks to filter messages independently based on their configuration.

// Console shows only warnings and above
consoleSink->setMinLevel(LogLevel::Warning);
// File captures all messages including trace
fileSink->setMinLevel(LogLevel::Trace);
virtual void setMinLevel(
LogLevel level
) =0

Set the minimum log level for this sink.

Parameters:

  • level The minimum level to accept (inclusive)

Reimplemented by: EntropyEngine::Core::Logging::ConsoleSink::setMinLevel

Controls verbosity of this specific sink. Each sink maintains its own level setting for flexible log routing.

// Development configuration
sink->setMinLevel(LogLevel::Debug);
// Production configuration
sink->setMinLevel(LogLevel::Warning);
// Debugging mode
sink->setMinLevel(LogLevel::Trace);
virtual void flush() =0

Flush any buffered data.

Reimplemented by: EntropyEngine::Core::Logging::ConsoleSink::flush

Forces immediate write of buffered data. Called after critical messages and during shutdown. Sinks without buffering can implement as no-op.


Updated on 2026-01-26 at 17:14:35 -0500