Write-KrDebugLog
SYNOPSIS
Write a debug log message using the Kestrun logging framework.
SYNTAX
MsgTemp (Default)
Write-KrDebugLog [-Message] <String> [-Name <String>] [-Exception <Exception>] [-Values <Object[]>] [-PassThru]
[<CommonParameters>]
ErrRec
Write-KrDebugLog [[-Message] <String>] [-Name <String>] [-Exception <Exception>] -ErrorRecord <ErrorRecord>
[-Values <Object[]>] [-PassThru] [<CommonParameters>]
DESCRIPTION
This function writes a debug log message to the specified logger or the default logger.
EXAMPLES
EXAMPLE 1
Write-KrDebugLog -Message "Debug message with properties: {0}, {1}" -Values "value1", "value2"
This example logs a debug message with two properties.
EXAMPLE 2
Write-KrDebugLog -Message "An error occurred" -Exception $exception -Logger $myLogger
This example logs a debug message with an exception using a specific logger.
EXAMPLE 3
Write-KrDebugLog -Message "Fatal error" -ErrorRecord $errorRecord
This example logs a fatal error message using an error record.
PARAMETERS
-Message
The message template to log. This can include placeholders for properties.
Type: String
Parameter Sets: MsgTemp
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Type: String
Parameter Sets: ErrRec
Aliases:
Required: False
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-Name
The name of the log entry.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Exception
An optional exception to log along with the message.
Type: Exception
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ErrorRecord
An optional error record to log. If provided, it will be logged as a fatal error.
Type: ErrorRecord
Parameter Sets: ErrRec
Aliases: ER
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Values
An array of property values to include in the log message.
Type: Object[]
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-PassThru
If specified, the function will return the logger object after logging.
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
OUTPUTS
NOTES
This function is part of the Kestrun logging framework and is used to log debug messages. It can be used in scripts and modules that utilize Kestrun for logging.