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
TCategoryThe 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
settingsLogCategorySettingsBase<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
categoryTCategoryThe log category.
messagestringThe log message.
levelLogLevelThe 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
librariesCategoryTCategoryThe 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