Enable-PodeLogErrorType
SYNOPSIS
Enables Error Log Type using a supplied Log Method.
SYNTAX
ScriptBlock (Default)
Enable-PodeLogErrorType [-Name <String>] -Method <String[]> [-Levels <String[]>]
[-Kind <PodeRequestExceptionKind[]>] [-LogFormat <PodeLogFormat>] [-LogScriptBlock <ScriptBlock>]
[-SerialiseFormat <PodeSerialiseFormat>] [-SerialiseScriptBlock <ScriptBlock>] [-ScriptBlock <ScriptBlock>]
[-ArgumentList <Object[]>] [-SyslogInfo <Hashtable>] [-AsUtc] [-ProgressAction <ActionPreference>]
[<CommonParameters>]
Raw
Enable-PodeLogErrorType [-Name <String>] -Method <String[]> [-Levels <String[]>]
[-Kind <PodeRequestExceptionKind[]>] [-LogFormat <PodeLogFormat>] [-LogScriptBlock <ScriptBlock>]
[-SerialiseFormat <PodeSerialiseFormat>] [-SerialiseScriptBlock <ScriptBlock>] [-SyslogInfo <Hashtable>]
[-AsUtc] [-Raw] [-ProgressAction <ActionPreference>] [<CommonParameters>]
DESCRIPTION
Enables Error Log Type using a supplied Log Method.
EXAMPLES
EXAMPLE 1
New-PodeLogTerminalMethod | Enable-PodeLogErrorType
EXAMPLE 2
New-PodeLogTerminalMethod | Enable-PodeLogErrorType -Kind Server, Client
EXAMPLE 3
New-PodeLogTerminalMethod | Enable-PodeLogErrorType -AsUtc
EXAMPLE 4
New-PodeLogTerminalMethod | Enable-PodeLogErrorType -Name 'custom-error' -SerialiseFormat 'Json'
EXAMPLE 5
New-PodeLogTerminalMethod | Enable-PodeLogErrorType -SerialiseFormat 'Custom' -SerialiseScriptBlock {
param($data)
return $data | ConvertTo-PodeString
}
EXAMPLE 6
New-PodeLogTerminalMethod | Enable-PodeLogErrorType -ScriptBlock {
param($logEvent)
return @{
StackTrace = $logEvent.Data.StackTrace
}
}
EXAMPLE 7
$syslogInfo = New-PodeLogSyslogInfo -Format RFC3164
New-PodeLogTerminalMethod | Enable-PodeLogErrorType -LogFormat Syslog -SyslogInfo $syslogInfo
PARAMETERS
-ArgumentList
An array of arguments to supply to the Custom Log Type's ScriptBlock and SerialiseScriptBlock.
Type: Object[]
Parameter Sets: ScriptBlock
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-AsUtc
If supplied, the log entry's timestamp will be in UTC, otherwise it will be in local time.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-Kind
The Kinds of errors that should be logged (Default: Server)
Type: PodeRequestExceptionKind[]
Parameter Sets: (All)
Aliases:
Accepted values: Client, Timeout, Server
Required: False
Position: Named
Default value: @([Pode.Protocols.Common.Requests.PodeRequestExceptionKind]::Server)
Accept pipeline input: False
Accept wildcard characters: False
-Levels
The Levels of errors that should be logged (Default: Emergency, Alert, Critical, Error)
Type: String[]
Parameter Sets: (All)
Aliases: Level
Required: False
Position: Named
Default value: @('Emergency', 'Alert', 'Critical', 'Error')
Accept pipeline input: False
Accept wildcard characters: False
-LogFormat
The format to use for the log output. (Default: Server default, or 'None' if no default set).
Type: PodeLogFormat
Parameter Sets: (All)
Aliases:
Accepted values: None, Custom, Syslog
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-LogScriptBlock
A ScriptBlock to use for custom log formatting of the log entry.
Type: ScriptBlock
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Method
One or more Log Method IDs to use for outputting the log entry.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-Name
An optional Name to assign to the Error Log Type. If not supplied, a default name will be used.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ProgressAction
{{ Fill ProgressAction Description }}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Raw
If supplied, the log item returned will be the raw Error item as a hashtable and not a string (for Custom methods).
Type: SwitchParameter
Parameter Sets: Raw
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-ScriptBlock
A ScriptBlock to use for custom data selection and transforming of the log entry. (Default: inbuilt logic).
Type: ScriptBlock
Parameter Sets: ScriptBlock
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-SerialiseFormat
Specifies the format to use for serialising the log entry. (Default: Server default, or 'Custom' if no default set, or 'None' if Raw is supplied).
Type: PodeSerialiseFormat
Parameter Sets: (All)
Aliases:
Accepted values: None, Custom, Json, Xml, Yaml
Required: False
Position: Named
Default value: Custom
Accept pipeline input: False
Accept wildcard characters: False
-SerialiseScriptBlock
A ScriptBlock to use for custom serialisation of the log entry.
Type: ScriptBlock
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-SyslogInfo
A hashtable containing Syslog configuration information, built using New-PodeSyslogInfo.
Type: Hashtable
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
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.