Add-KrEnrichWithEnvironment

SYNOPSIS

Adds environment information to the log context.

SYNTAX

Add-KrEnrichWithEnvironment [-loggerConfig] <LoggerConfiguration> [-UserName] [-MachineName]
 [<CommonParameters>]

DESCRIPTION

Adds environment information such as UserName and MachineName to the log context, allowing it to be included in log events.

EXAMPLES

EXAMPLE 1

New-KrLogger | Add-KrEnrichWithEnvironment | Register-KrLogger

PARAMETERS

-loggerConfig

Instance of LoggerConfiguration

Type: LoggerConfiguration
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-UserName

If specified, enriches logs with the current user’s name.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-MachineName

If specified, enriches logs with the current machine’s name.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

None

OUTPUTS

LoggerConfiguration object allowing method chaining

NOTES