< Back

New-PodeLoggingMethod

Sat Jan 18, 2020 7:17 pm

NAME New-PodeLoggingMethod



SYNOPSIS

Create a new method of outputting logs.





SYNTAX

New-PodeLoggingMethod [-Terminal] [<CommonParameters>]



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

[<CommonParameters>]



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





DESCRIPTION

Create a new method of outputting logs.





PARAMETERS

-Terminal [<SwitchParameter>]

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



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-File [<SwitchParameter>]

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



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Path <String>

The File Path of where to store the logs.



Required? false

Position? named

Default value ./logs

Accept pipeline input? false

Accept wildcard characters? false



-Name <String>

The File Name to prepend new log files using.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-MaxDays <Int32>

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



Required? false

Position? named

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-MaxSize <Int32>

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



Required? false

Position? named

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-Custom [<SwitchParameter>]

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



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-ScriptBlock <ScriptBlock>

The ScriptBlock that defines how to output a log item.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ArgumentList <Object[]>

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



Required? false

Position? named

Default value

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

System.Collections.Hashtable





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



PS C:\\>$term_logging = New-PodeLoggingMethod -Terminal













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



PS C:\\>$file_logging = New-PodeLoggingMethod -File -Path ./logs -Name 'requests'













-------------------------- EXAMPLE 3 --------------------------



PS C:\\>$custom_logging = New-PodeLoggingMethod -Custom -ScriptBlock { /* logic */ }















RELATED LINKS