Skip to content

New-PodeLoggingMethod

SYNOPSIS

Create a new method of outputting logs.

SYNTAX

Terminal (Default)

New-PodeLoggingMethod [-Id <String>] [-Terminal] [-Batch <Int32>] [-BatchTimeout <Int32>]
 [-ProgressAction <ActionPreference>] [<CommonParameters>]

File

New-PodeLoggingMethod [-Id <String>] [-File] [-Path <String>] -Name <String> [-Batch <Int32>]
 [-BatchTimeout <Int32>] [-MaxDays <Int32>] [-MaxSize <Int32>] [-ProgressAction <ActionPreference>]
 [<CommonParameters>]

EventViewer

New-PodeLoggingMethod [-Id <String>] [-EventViewer] [-EventLogName <String>] [-Source <String>]
 [-EventID <Int32>] [-Batch <Int32>] [-BatchTimeout <Int32>] [-ProgressAction <ActionPreference>]
 [<CommonParameters>]

Custom

New-PodeLoggingMethod [-Id <String>] [-Batch <Int32>] [-BatchTimeout <Int32>] [-Custom]
 -ScriptBlock <ScriptBlock> [-ArgumentList <Object[]>] [-ProgressAction <ActionPreference>]
 [<CommonParameters>]

DESCRIPTION

This function has been deprecated and will be removed in future versions. It creates various Log Methods for outputting logs. Please use the appropriate new functions for each Log Method: - New-PodeLogTerminalMethod - New-PodeLogFileMethod - New-PodeLogEventViewerMethod - New-PodeLogCustomMethod

EXAMPLES

EXAMPLE 1

$term_logging_id = New-PodeLoggingMethod -Terminal

EXAMPLE 2

$file_logging_id = New-PodeLoggingMethod -File -Path ./logs -Name 'requests'

EXAMPLE 3

$custom_logging_id = New-PodeLoggingMethod -Custom -ScriptBlock { /* logic */ }

PARAMETERS

-ArgumentList

An array of arguments to supply to the Custom Logging output method's ScriptBlock.

Type: Object[]
Parameter Sets: Custom
Aliases:

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

-Batch

An optional batch size to write log items in bulk (Default: 1)

Type: Int32
Parameter Sets: (All)
Aliases:

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

-BatchTimeout

An optional batch timeout, in seconds, to send items off for writing if a log item isn't received (Default: 0)

Type: Int32
Parameter Sets: (All)
Aliases:

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

-Custom

If supplied, will allow you to create a Custom Logging output method.

Type: SwitchParameter
Parameter Sets: Custom
Aliases:

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

-EventID

Optional EventID for the Event Viewer (Default: 0)

Type: Int32
Parameter Sets: EventViewer
Aliases:

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

-EventLogName

Optional Log Name for the Event Viewer (Default: Application)

Type: String
Parameter Sets: EventViewer
Aliases:

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

-EventViewer

If supplied, will use the inbuilt Event Viewer logging output method.

Type: SwitchParameter
Parameter Sets: EventViewer
Aliases:

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

-File

If supplied, will use the inbuilt File logging output method.

Type: SwitchParameter
Parameter Sets: File
Aliases:

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

-Id

An optional ID to assign to the Log Method. If not supplied, a random ID will be generated.

Type: String
Parameter Sets: (All)
Aliases:

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

-MaxDays

The maximum number of days to keep logs, before Pode automatically removes them.

Type: Int32
Parameter Sets: File
Aliases:

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

-MaxSize

The maximum size of a log file, before Pode starts writing to a new log file.

Type: Int32
Parameter Sets: File
Aliases:

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

-Name

The File Name to prepend new log files using.

Type: String
Parameter Sets: File
Aliases:

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

-Path

The File Path of where to store the logs.

Type: String
Parameter Sets: File
Aliases:

Required: False
Position: Named
Default value: ./logs
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

-ScriptBlock

The ScriptBlock that defines how to output a log item.

Type: ScriptBlock
Parameter Sets: Custom
Aliases:

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

-Source

Optional Source for the Event Viewer (Default: Pode)

Type: String
Parameter Sets: EventViewer
Aliases:

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

-Terminal

If supplied, will use the inbuilt Terminal logging output method.

Type: SwitchParameter
Parameter Sets: Terminal
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

System.String

NOTES