< Summary - Kestrun — Combined Coverage

Information
Class: Public.Logging.enrichers.Add-KrEnrichProperty
Assembly: Kestrun.PowerShell.Public
File(s): /home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/Logging/enrichers/Add-KrEnrichProperty.ps1
Tag: Kestrun/Kestrun@9d3a582b2d63930269564a7591aa77ef297cadeb
Line coverage
0%
Covered lines: 0
Uncovered lines: 1
Coverable lines: 1
Total lines: 40
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/enrichers/Add-KrEnrichProperty.ps1

#LineLine coverage
 1<#
 2    .SYNOPSIS
 3        Enriches log events with custom property.
 4    .DESCRIPTION
 5        Enriches log events with custom property. For example script name.
 6    .PARAMETER LoggerConfig
 7        Instance of LoggerConfiguration
 8    .PARAMETER Name
 9        The name of the property
 10    .PARAMETER Value
 11        The value of the property
 12    .PARAMETER DestructureObjects
 13        If present, and the value is a non-primitive, non-array type, then the value will be converted to a structure; o
 14    .INPUTS
 15        None
 16    .OUTPUTS
 17        LoggerConfiguration object allowing method chaining
 18    .EXAMPLE
 19        PS> New-KrLogger | Add-KrEnrichProperty -Name ScriptName -Value 'Test' | Add-KrSinkConsole | Register-KrLogger
 20    #>
 21function Add-KrEnrichProperty {
 22    [KestrunRuntimeApi('Everywhere')]
 23    [OutputType([Serilog.LoggerConfiguration])]
 24    [CmdletBinding()]
 25    param(
 26        [Parameter(Mandatory = $true, ValueFromPipeline = $true)]
 27        [Serilog.LoggerConfiguration]$LoggerConfig,
 28        [Parameter(Mandatory = $true)]
 29        [string]$Name,
 30        [Parameter(Mandatory = $true)]
 31        [object]$Value,
 32        [Parameter()]
 33        [switch]$DestructureObjects
 34    )
 35
 36    process {
 037        return $LoggerConfig.Enrich.WithProperty($Name, $Value, $DestructureObjects.IsPresent)
 38    }
 39}
 40

Methods/Properties

Add-KrEnrichProperty()