< Back

Write-PodeErrorLog

Sat Jan 18, 2020 7:21 pm

NAME Write-PodeErrorLog



SYNOPSIS

Writes and Exception or ErrorRecord using the inbuilt error logging.





SYNTAX

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



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





DESCRIPTION

Writes and Exception or ErrorRecord using the inbuilt error logging.





PARAMETERS

-Exception <Exception>

An Exception to write.



Required? true

Position? named

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-ErrorRecord <ErrorRecord>

An ErrorRecord to write.



Required? true

Position? named

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Level <String>

The Level of the error being logged.



Required? false

Position? named

Default value Error

Accept pipeline input? false

Accept wildcard characters? false



-CheckInnerException [<SwitchParameter>]

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



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>try { /* logic */ } catch { $_ | Write-PodeErrorLog }













-------------------------- EXAMPLE 2 --------------------------



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















RELATED LINKS