< Summary - Kestrun — Combined Coverage

Information
Class: Public.Logging.core.Get-KrLogger
Assembly: Kestrun.PowerShell.Public
File(s): /home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/Logging/core/Get-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 08/26/2025 - 01:25:22 Line coverage: 0% (0/3) Total lines: 35 Tag: Kestrun/Kestrun@07f821172e5dc3657f1be7e6818f18d6721cf38a09/04/2025 - 22:37:32 Line coverage: 0% (0/3) Total lines: 36 Tag: Kestrun/Kestrun@afb7aadc0a8a42bfa2b51ea62c8a6e2cf63faec6

Metrics

File(s)

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

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

Methods/Properties

Get-KrDefaultLogger()