-
Notifications
You must be signed in to change notification settings - Fork 49
Write‐Log
external help file: Logging-help.xml Module Name: Logging online version: https://logging.readthedocs.io/en/latest/functions/Write-Log.md schema: 2.0.0
Emits a log record
Write-Log [-Message] <String> [[-Arguments] <Array>] [[-Body] <Object>] [[-ExceptionInfo] <ErrorRecord>]
[-Level <String>] [<CommonParameters>]
This function write a log record to configured targets with the matching level
Write-Log 'Hello, World!'
Write-Log -Level ERROR -Message 'Hello, World!'
Write-Log -Level ERROR -Message 'Hello, {0}!' -Arguments 'World'
Write-Log -Level ERROR -Message 'Hello, {0}!' -Arguments 'World' -Body @{Server='srv01.contoso.com'}
The text message to write
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
An array of objects used to format <Message>
Type: Array
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
An object that can contain additional log metadata (used in target like ElasticSearch)
Type: Object
Parameter Sets: (All)
Aliases:
Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
An optional ErrorRecord
Type: ErrorRecord
Parameter Sets: (All)
Aliases:
Required: False
Position: 6
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
{{ Fill Level Description }}
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.
https://logging.readthedocs.io/en/latest/functions/Write-Log.md
https://logging.readthedocs.io/en/latest/functions/Add-LoggingLevel.md
https://github.com/EsOsO/Logging/blob/master/Logging/public/Write-Log.ps1