Table of Contents

Class LogRouter<TCategory>

Namespace
SunamoLogging.LogRouter
Assembly
SunamoLogging.dll

Routes log messages through category-based filtering and raises events for logged entries.

public class LogRouter<TCategory> where TCategory : struct, Enum

Type Parameters

TCategory

The enum type representing log categories.

Inheritance
LogRouter<TCategory>
Inherited Members
Extension Methods

Constructors

LogRouter(LogCategorySettingsBase<TCategory>)

Routes log messages through category-based filtering and raises events for logged entries.

public LogRouter(LogCategorySettingsBase<TCategory> settings)

Parameters

settings LogCategorySettingsBase<TCategory>

The category settings that control which categories are enabled.

Methods

Log(TCategory, string, LogLevel)

Logs a message under the specified category and level.

public void Log(TCategory category, string message, LogLevel level = LogLevel.Information)

Parameters

category TCategory

The log category.

message string

The log message.

level LogLevel

The log level (defaults to Information).

ToILogger(TCategory)

Creates an ILogger adapter that routes messages through this LogRouter under the specified category.

public ILogger ToILogger(TCategory librariesCategory)

Parameters

librariesCategory TCategory

The category to use for routed messages.

Returns

ILogger

An ILogger instance that routes through this LogRouter.

Events

Logged

Event raised when a message is logged.

public event Action<LogEntry<TCategory>>? Logged

Event Type

Action<LogEntry<TCategory>>