< Back

Set-LoggingDefaultFormat

Sat Jan 18, 2020 9:51 am

NAME Set-LoggingDefaultFormat



SYNOPSIS

Sets a global logging message format





SYNTAX

Set-LoggingDefaultFormat [[-Format] <String>] [<CommonParameters>]





DESCRIPTION

This function sets a global logging message format





PARAMETERS

-Format <String>

The string used to format the message to log



Required? false

Position? 1

Default value $Defaults.Format

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



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



PS C:\\>Set-LoggingDefaultFormat -Format '[%{level:-7}] %{message}'













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



PS C:\\>Set-LoggingDefaultFormat



It sets the default format as [%{timestamp:+%Y-%m-%d %T%Z}] [%{level:-7}] %{message}











RELATED LINKS

https://logging.readthedocs.io/en/lates ... tFormat.md

https://logging.readthedocs.io/en/lates ... gFormat.md

https://logging.readthedocs.io/en/lates ... ite-Log.md

https://github.com/EsOsO/Logging/blob/m ... Format.ps1