< Summary - Kestrun — Combined Coverage

Information
Class: Public.Logging.core.Test-KrLogger
Assembly: Kestrun.PowerShell.Public
File(s): /home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/Logging/core/Test-KrLogger.ps1
Tag: Kestrun/Kestrun@2d87023b37eb91155071c91dd3d6a2eeb3004705
Line coverage
0%
Covered lines: 0
Uncovered lines: 3
Coverable lines: 3
Total lines: 36
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 09/12/2025 - 03:43:11 Line coverage: 0% (0/3) Total lines: 36 Tag: Kestrun/Kestrun@d160286e3020330b1eb862d66a37db2e26fc9042

Metrics

File(s)

/home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/Logging/core/Test-KrLogger.ps1

#LineLine coverage
 1<#
 2    .SYNOPSIS
 3        Tests if a logger exists or returns the current default logger for the session.
 4    .DESCRIPTION
 5        Gets the specified logger as the current logger for the session, or tests if a named logger exists.
 6    .PARAMETER Name
 7        The name of the logger to test for existence or get as the default logger.
 8    .OUTPUTS
 9        When the Name parameter is specified, it returns a boolean indicating whether the named logger exists.
 10        When the Name parameter is not specified, it returns the default logger instance.
 11    .EXAMPLE
 12        PS> $logger = Test-KrLogger
 13        Retrieves the current default logger instance for the session.
 14    .EXAMPLE
 15        PS> $logger = Test-KrLogger | Write-Host
 16        Retrieves the current default logger instance and outputs it to the console.
 17  .NOTES
 18        This function is part of the Kestrun logging framework and is used to retrieve the current default logger instan
 19        It can be used in scripts and modules that utilize Kestrun for logging.
 20#>
 21function Test-KrLogger {
 22    [KestrunRuntimeApi('Everywhere')]
 23    [CmdletBinding()]
 24    [OutputType([Serilog.ILogger])]
 25    [OutputType([string])]
 26    param(
 27        [Parameter(Mandatory = $false)]
 28        [switch]$Name
 29    )
 030    if ($Name) {
 031        return ([Kestrun.Logging.LoggerManager]::Contains($Name))
 32    }
 33
 034    return [Kestrun.Logging.LoggerManager]::DefaultLogger.ToString() -ne "Serilog.Core.Pipeline.SilentLogger"
 35}
 36

Methods/Properties

Test-KrLogger()