Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 50e6aeb

Browse files
committedDec 9, 2016
Update example
1 parent 9e8e257 commit 50e6aeb

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed
 

‎README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,17 @@ logger management and how to log the log messages.
7979
Start-ScriptLogger
8080
8181
# Second options, specify multiple custom settings for the logger
82-
Start-ScriptLogger -Path 'C:\Temp\test.log' -Format '{0:yyyy-MM-dd} {0:HH:mm:ss} {1} {2} {3,-11} {4}' -Level Warning -NoEventLog -NoConsoleOutput
82+
Start-ScriptLogger -Path 'C:\Temp\test.log' -Format '{0:yyyy-MM-dd} {0:HH:mm:ss} {1} {2} {3,-11} {4}' -Level Warning -Encoding 'UTF8' -NoEventLog -NoConsoleOutput
8383
8484
# Get the current script logger configuration object
8585
Get-ScriptLogger
8686
8787
# Update the script logger configuration
8888
Set-ScriptLogger -Level Verbose
8989
90+
# Log an error record
91+
try { 0 / 0 } catch { Write-ErrorLog -ErrorRecord $_ }
92+
9093
# Log an error message
9194
Write-ErrorLog -Message 'My Error Message'
9295

‎Tests/Integration/LoggerDemo.ps1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@
33
Start-ScriptLogger
44

55
# Second options, specify multiple custom settings for the logger
6-
Start-ScriptLogger -Path 'C:\Temp\test.log' -Format '{0:yyyy-MM-dd} {0:HH:mm:ss} {1} {2} {3,-11} {4}' -Level Warning -Encoding 'UTF7' -SkipEventLog -HideConsoleOutput
6+
Start-ScriptLogger -Path 'C:\Temp\test.log' -Format '{0:yyyy-MM-dd} {0:HH:mm:ss} {1} {2} {3,-11} {4}' -Level Warning -Encoding 'UTF8' -NoEventLog -NoConsoleOutput
77

88
# Get the current script logger configuration object
99
Get-ScriptLogger
1010

1111
# Update the script logger configuration
1212
Set-ScriptLogger -Level Verbose
1313

14+
# Log an error record
15+
try { 0 / 0 } catch { Write-ErrorLog -ErrorRecord $_ }
16+
1417
# Log an error message
1518
Write-ErrorLog -Message 'My Error Message'
1619

0 commit comments

Comments
 (0)
Please sign in to comment.