Skip to content

New-PodeLoggingMethod

SYNOPSIS

Create a new method of outputting logs.

SYNTAX

Terminal (Default)

New-PodeLoggingMethod [-Terminal] [-Batch <Int32>] [-BatchTimeout <Int32>] [<CommonParameters>]

File

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

EventViewer

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

Custom

New-PodeLoggingMethod [-Batch <Int32>] [-BatchTimeout <Int32>] [-Custom] -ScriptBlock <ScriptBlock>
 [-ArgumentList <Object[]>] [<CommonParameters>]

DESCRIPTION

Create a new method of outputting logs.

EXAMPLES

EXAMPLE 1

$term_logging = New-PodeLoggingMethod -Terminal

EXAMPLE 2

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

EXAMPLE 3

$custom_logging = 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

-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

-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.Collections.Hashtable

NOTES