Class LoggerSinkConfigurationExtensions
Provides extension methods for configuring Serilog sinks with conditional log level processing.
Inherited Members
Namespace: Coree.NETStandard.Serilog
Assembly: Coree.NETStandard.dll
Syntax
public static class LoggerSinkConfigurationExtensions
Methods
| Edit this page View SourceConsoleConditionalLevel(LoggerSinkConfiguration, LogEventLevel, string, IFormatProvider?, LoggingLevelSwitch?, LogEventLevel?, ConsoleTheme?, bool, object?, Dictionary<string, LogEventLevel>?)
Adds a console sink with conditional log level processing to the logger configuration.
Declaration
public static LoggerConfiguration ConsoleConditionalLevel(this LoggerSinkConfiguration loggerConfiguration, LogEventLevel restrictedToMinimumLevel = LogEventLevel.Verbose, string outputTemplate = "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}", IFormatProvider? formatProvider = null, LoggingLevelSwitch? levelSwitch = null, LogEventLevel? standardErrorFromLevel = null, ConsoleTheme? theme = null, bool applyThemeToRedirectedOutput = false, object? syncRoot = null, Dictionary<string, LogEventLevel>? conditionalLevel = null)
Parameters
| Type | Name | Description |
|---|---|---|
| LoggerSinkConfiguration | loggerConfiguration | The logger configuration to modify. |
| LogEventLevel | restrictedToMinimumLevel | The minimum log event level required for events to be passed to the sink. |
| string | outputTemplate | The output template determining the format of log events. |
| IFormatProvider | formatProvider | The format provider for formatting log event properties. |
| LoggingLevelSwitch | levelSwitch | A switch allowing the pass-through log event level to be changed at runtime. |
| LogEventLevel? | standardErrorFromLevel | The log event level at which to start writing to standard error instead of standard output. |
| ConsoleTheme | theme | The theme to apply to the output. |
| bool | applyThemeToRedirectedOutput | Whether to apply the theme to redirected output streams. |
| object | syncRoot | An object to synchronize the log event emission. |
| Dictionary<string, LogEventLevel> | conditionalLevel | A dictionary mapping specific conditions to log event levels for conditional processing. |
Returns
| Type | Description |
|---|---|
| LoggerConfiguration | The modified logger configuration. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when loggerConfiguration is null. |
DebugConditionalLevel(LoggerSinkConfiguration, LogEventLevel, string, IFormatProvider?, LoggingLevelSwitch?, Dictionary<string, LogEventLevel>?)
Adds a debug sink with conditional log level processing to the logger configuration.
Declaration
public static LoggerConfiguration DebugConditionalLevel(this LoggerSinkConfiguration loggerConfiguration, LogEventLevel restrictedToMinimumLevel = LogEventLevel.Verbose, string outputTemplate = "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}", IFormatProvider? formatProvider = null, LoggingLevelSwitch? levelSwitch = null, Dictionary<string, LogEventLevel>? conditionalLevel = null)
Parameters
| Type | Name | Description |
|---|---|---|
| LoggerSinkConfiguration | loggerConfiguration | The logger configuration to modify. |
| LogEventLevel | restrictedToMinimumLevel | The minimum log event level required for events to be passed to the sink. |
| string | outputTemplate | The output template determining the format of log events. |
| IFormatProvider | formatProvider | The format provider for formatting log event properties. |
| LoggingLevelSwitch | levelSwitch | A switch allowing the pass-through log event level to be changed at runtime. |
| Dictionary<string, LogEventLevel> | conditionalLevel | A dictionary mapping specific conditions to log event levels for conditional processing. |
Returns
| Type | Description |
|---|---|
| LoggerConfiguration | The modified logger configuration. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when loggerConfiguration is null. |