< 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@9d3a582b2d63930269564a7591aa77ef297cadeb
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

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]::DefaultLoggerName
 33    }
 034    return [Kestrun.Logging.LoggerManager]::DefaultLogger
 35}
 36

Methods/Properties

Get-KrDefaultLogger()