ConsoleMonsterLoggerProvider
ConsoleMonster.Extensions.Logging
Writes Microsoft.Extensions.Logging entries the ConsoleMonster way: the level tag and colour of Write-ConsoleLogEntry and the log region, a timestamp, the category and scopes, then the message (and the exception under it). While a live session with a log region runs (a dashboard), entries go into that region, so they never print over the view; otherwise they are printed as lines, plain when the output is redirected. Thread-safe.
Inheritance
- object
- ConsoleMonsterLoggerProvider
Constructors
public ConsoleMonsterLoggerProvider(ConsoleMonsterLoggerOptions? options = null) #Creates the provider.
Parameters
- options ConsoleMonster.Extensions.Logging.ConsoleMonsterLoggerOptions? = null
- Options, or null for the defaults.
Methods
public ILogger CreateLogger(string categoryName) #Gets or creates a logger for the supplied category, using this provider's rendering options and scopes.
Parameters
- categoryName string
- The category included with messages when category display is enabled.
Returns
ILogger The cached logger for this category.public void Dispose() #Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public static string LevelName(LogLevel level) #The ConsoleMonster level (info, warn, err, verbose, debug) for a logging level.
Parameters
- level Microsoft.Extensions.Logging.LogLevel
- The logging level.
Returns
string The level name.public void SetScopeProvider(IExternalScopeProvider scopeProvider) #Uses the supplied external scope provider for messages created by this provider's loggers.
Parameters
- scopeProvider Microsoft.Extensions.Logging.IExternalScopeProvider
- The scope provider; null selects a new default scope provider.