-
Notifications
You must be signed in to change notification settings - Fork 49
File
Massimo Bonvicini edited this page Aug 27, 2019
·
2 revisions
> Add-LoggingTarget -Name File -Configuration @{
Path = <NOTSET> # <Required> Sets the file destination (eg. 'C:\Temp\%{+%Y%m%d}.log')
# It supports templating like $Logging.Format
PrintBody = $false # <Not required> Prints body message too
Append = $true # <Not required> Append to log file
Encoding = 'ascii' # <Not required> Sets the log file encoding
Level = <NOTSET> # <Not required> Sets the logging level for this target
Format = <NOTSET> # <Not required> Sets the logging format for this target
}
Write-Log -Level 'WARNING' -Message 'Hello, Powershell!'
Write-Log -Level 'WARNING' -Message 'Hello, {0}!' -Arguments 'Powershell'
Write-Log -Level 'WARNING' -Message 'Hello, {0}!' -Arguments 'Powershell' -Body @{source = 'Logging'}