EntropyEngine::Core::Logging::ILogSink
EntropyEngine::Core::Logging::ILogSink
Section titled “EntropyEngine::Core::Logging::ILogSink”Interface for log sinks that handle log output. More…
#include <ILogSink.h>
Inherited by EntropyEngine::Core::Logging::ConsoleSink
Public Functions
Section titled “Public Functions”| Name | |
|---|---|
| virtual | ~ILogSink() =default |
| virtual void | write(const LogEntry & entry) =0 Write a log entry to this sink. |
| virtual bool | shouldLog(LogLevel level) const =0 Check if this sink accepts logs at the given level. |
| virtual void | setMinLevel(LogLevel level) =0 Set the minimum log level for this sink. |
| virtual void | flush() =0 Flush any buffered data. |
Detailed Description
Section titled “Detailed Description”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.
Public Functions Documentation
Section titled “Public Functions Documentation”function ~ILogSink
Section titled “function ~ILogSink”virtual ~ILogSink() =defaultfunction write
Section titled “function write”virtual void write( const LogEntry & entry) =0Write 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);}function shouldLog
Section titled “function shouldLog”virtual bool shouldLog( LogLevel level) const =0Check 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 aboveconsoleSink->setMinLevel(LogLevel::Warning);
// File captures all messages including tracefileSink->setMinLevel(LogLevel::Trace);function setMinLevel
Section titled “function setMinLevel”virtual void setMinLevel( LogLevel level) =0Set 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 configurationsink->setMinLevel(LogLevel::Debug);
// Production configurationsink->setMinLevel(LogLevel::Warning);
// Debugging modesink->setMinLevel(LogLevel::Trace);function flush
Section titled “function flush”virtual void flush() =0Flush 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