< Summary - Kestrun — Combined Coverage

Information
Class: Public.Logging.core.Set-KrLoggerMinimumLevel
Assembly: Kestrun.PowerShell.Public
File(s): /home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/Logging/core/Set-KrLoggerMinimumLevel.ps1
Tag: Kestrun/Kestrun@5f1d2b981c9d7292c11fd448428c6ab6c811c5de
Line coverage
0%
Covered lines: 0
Uncovered lines: 10
Coverable lines: 10
Total lines: 58
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 11/19/2025 - 17:40:50 Line coverage: 0% (0/10) Total lines: 58 Tag: Kestrun/Kestrun@fcf33342333cef0516fe0d0912a86709874fd026

Metrics

File(s)

/home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/Logging/core/Set-KrLoggerMinimumLevel.ps1

#LineLine coverage
 1<#
 2    .SYNOPSIS
 3        Sets the minimum log level for the logger configuration.
 4    .DESCRIPTION
 5        Sets the minimum log level for the logger configuration. This cmdlet can be used to
 6        set the minimum log level to a specific level or to the user's preference.
 7    .PARAMETER LoggerConfig
 8        Instance of Serilog.LoggerConfiguration to set the minimum level for.
 9    .PARAMETER Value
 10        The minimum log level to set for the logger configuration.
 11    .PARAMETER Dynamic
 12        If specified, the minimum log level will be controlled by a level switch.
 13    .INPUTS
 14        Instance of Serilog.LoggerConfiguration
 15    .OUTPUTS
 16        Instance of Serilog.LoggerConfiguration if the PassThru parameter is specified.
 17    .EXAMPLE
 18        PS> Set-KrLoggerLevel -LoggerConfig $myLoggerConfig -Values Warning
 19        Sets the minimum log level of the specified logger configuration to Warning.
 20        .EXAMPLE
 21        PS> Set-KrLoggerLevel -LoggerConfig $myLoggerConfig -ControlledBy $myLevelSwitch
 22        Sets the minimum log level of the specified logger configuration to be controlled by the specified level switch.
 23    .EXAMPLE
 24        PS> $myLoggerConfig | Set-KrLoggerLevel -Value Information -PassThru
 25        Sets the minimum log level of the specified logger configuration to Information and outputs the LoggerConfigurat
 26#>
 27function Set-KrLoggerLevel {
 28    [KestrunRuntimeApi('Everywhere')]
 29    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '')]
 30    [OutputType([Serilog.LoggerConfiguration])]
 31    [CmdletBinding(DefaultParameterSetName = 'Static')]
 32    param(
 33        [Parameter(Mandatory = $true, ValueFromPipeline = $true)]
 34        [Serilog.LoggerConfiguration]$LoggerConfig,
 35        [Parameter(Mandatory = $true, ParameterSetName = 'Static')]
 36        [Alias('Level')]
 37        [Serilog.Events.LogEventLevel]$Value,
 38        [Parameter(Mandatory = $true, ParameterSetName = 'Dynamic')]
 39        [Serilog.Events.LogEventLevel]$Dynamic
 40    )
 41
 42    process {
 043        if ($PsCmdlet.ParameterSetName -eq 'Dynamic') {
 044            return [Kestrun.Logging.LoggerConfigurationExtensions]::EnsureSwitch($LoggerConfig, $Dynamic)
 45        } else {
 046            switch ($Value) {
 047                Verbose { return $LoggerConfig.MinimumLevel.Verbose() }
 048                Debug { return $LoggerConfig.MinimumLevel.Debug() }
 049                Information { return $LoggerConfig.MinimumLevel.Information() }
 050                Warning { return $LoggerConfig.MinimumLevel.Warning() }
 051                Error { return $LoggerConfig.MinimumLevel.Error() }
 052                Fatal { return $LoggerConfig.MinimumLevel.Fatal() }
 053                default { return $LoggerConfig.MinimumLevel.Information() }
 54            }
 55        }
 56    }
 57}
 58

Methods/Properties

Set-KrLoggerLevel()