Skip to content

Write-PodeErrorLog

SYNOPSIS

Writes and Exception or ErrorRecord using the inbuilt error logging.

SYNTAX

Exception

Write-PodeErrorLog -Exception <Exception> [-Level <String>] [-CheckInnerException] [<CommonParameters>]

Error

Write-PodeErrorLog -ErrorRecord <ErrorRecord> [-Level <String>] [<CommonParameters>]

DESCRIPTION

Writes and Exception or ErrorRecord using the inbuilt error logging.

EXAMPLES

EXAMPLE 1

try { /* logic */ } catch { $_ | Write-PodeErrorLog }

EXAMPLE 2

[System.Exception]::new('error message') | Write-PodeErrorLog

PARAMETERS

-CheckInnerException

If supplied, any exceptions are check for inner exceptions. If one is present, this is also logged.

Type: SwitchParameter
Parameter Sets: Exception
Aliases:

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

-ErrorRecord

An ErrorRecord to write.

Type: ErrorRecord
Parameter Sets: Error
Aliases:

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

-Exception

An Exception to write.

Type: Exception
Parameter Sets: Exception
Aliases:

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

-Level

The Level of the error being logged.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: Error
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

Back to top