Set-KrLoggerLevel

SYNOPSIS

Sets the minimum log level for the logger configuration.

SYNTAX

Static (Default)

Set-KrLoggerLevel -LoggerConfig <LoggerConfiguration> -Value <LogEventLevel> [<CommonParameters>]

Dynamic

Set-KrLoggerLevel -LoggerConfig <LoggerConfiguration> -Dynamic <LogEventLevel> [<CommonParameters>]

DESCRIPTION

Sets the minimum log level for the logger configuration. This cmdlet can be used to set the minimum log level to a specific level or to the user’s preference.

EXAMPLES

EXAMPLE 1

Set-KrLoggerLevel -LoggerConfig $myLoggerConfig -Values Warning
Sets the minimum log level of the specified logger configuration to Warning.

EXAMPLE 2

Set-KrLoggerLevel -LoggerConfig $myLoggerConfig -ControlledBy $myLevelSwitch
Sets the minimum log level of the specified logger configuration to be controlled by the specified level switch.

EXAMPLE 3

$myLoggerConfig | Set-KrLoggerLevel -Value Information -PassThru
Sets the minimum log level of the specified logger configuration to Information and outputs the LoggerConfiguration object into the pipeline.

PARAMETERS

-LoggerConfig

Instance of Serilog.LoggerConfiguration to set the minimum level for.

Type: LoggerConfiguration
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-Value

The minimum log level to set for the logger configuration.

Type: LogEventLevel
Parameter Sets: Static
Aliases: Level
Accepted values: Verbose, Debug, Information, Warning, Error, Fatal

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Dynamic

If specified, the minimum log level will be controlled by a level switch.

Type: LogEventLevel
Parameter Sets: Dynamic
Aliases:
Accepted values: Verbose, Debug, Information, Warning, Error, Fatal

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

Instance of Serilog.LoggerConfiguration

OUTPUTS

Instance of Serilog.LoggerConfiguration if the PassThru parameter is specified.

NOTES