New PodeFileLoggingMethod - mdaneri/Pode GitHub Wiki
external help file: Pode-help.xml Module Name: Pode online version: PodeType: LoggingMethod schema: 2.0.0
Creates a new file-based logging method in Pode.
New-PodeFileLoggingMethod [-Path <String>] -Name <String> [-Format <String>] [-Separator <String>]
[-MaxLength <Int32>] [-MaxDays <Int32>] [-MaxSize <Int32>] [-FailureAction <String>] [-DataFormat <String>]
[-Encoding <String>] [-AsUTC] [-DefaultTag <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
New-PodeFileLoggingMethod [-Path <String>] -Name <String> [-Format <String>] [-Separator <String>]
[-MaxLength <Int32>] [-MaxDays <Int32>] [-MaxSize <Int32>] [-FailureAction <String>] [-Encoding <String>]
[-ISO8601] [-AsUTC] [-DefaultTag <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
This function sets up a logging method that outputs log messages to a file. It supports configuring log file paths, names, formats, sizes, and retention policies, along with various log formatting options such as custom date formats or ISO 8601.
$logMethod = New-PodeFileLoggingMethod -Path './logs' -Name 'requests'
Creates a new file logging method that stores logs in the './logs' directory with the base name 'requests'.
$logMethod = New-PodeFileLoggingMethod -Name 'requests' -MaxDays 7 -MaxSize 100MB
Creates a file logging method that keeps logs for 7 days and creates new files once the log file reaches 100MB in size.
If set, logs the time in UTC instead of the local time.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
The custom date format for log entries. Mutually exclusive with ISO8601.
Type: String
Parameter Sets: DataFormat
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The tag to use if none is specified on the log entry. Defaults to '-'.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: -
Accept pipeline input: False
Accept wildcard characters: False
The encoding to use for Syslog messages. Supported values are ASCII, BigEndianUnicode, Default, Unicode, UTF32, UTF7, and UTF8. Defaults to UTF8.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: UTF8
Accept pipeline input: False
Accept wildcard characters: False
Specifies the action to take if logging fails. Options are: Ignore, Report, Halt (Default: Ignore).
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: Ignore
Accept pipeline input: False
Accept wildcard characters: False
The format of the log entries. Supported options are: RFC3164, RFC5424, Simple, and Default (Default: Default).
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: Default
Accept pipeline input: False
Accept wildcard characters: False
If set, uses the ISO 8601 date format for log entries. Mutually exclusive with DataFormat.
Type: SwitchParameter
Parameter Sets: ISO8601
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
The maximum number of days to keep log files. Logs older than this will be removed automatically. Defaults to 0 (no automatic removal).
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
The maximum length of log entries. Defaults to -1 (no limit).
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: -1
Accept pipeline input: False
Accept wildcard characters: False
The maximum size of a log file in bytes. Once this size is exceeded, a new log file will be created. Defaults to 0 (no size limit).
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
The base name for the log files. This parameter is mandatory.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The file path where the logs will be stored. Defaults to './logs'.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: ./logs
Accept pipeline input: False
Accept wildcard characters: False
{{ 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
The character(s) used to separate log fields in each entry. Defaults to a space (' ').
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.