Update StackMonkey_v1.ps1
This commit is contained in:
@@ -293,7 +293,8 @@
|
||||
[Parameter(Mandatory)][string]$Message,
|
||||
[ValidateSet("Info","Warning","Error","Success","General")][string]$Level = "Info",
|
||||
[string]$TaskCategory = "GeneralTask",
|
||||
[switch]$LogToEvent, [string]$EventSource="SVSMSP_Module", [string]$EventLog="Application",
|
||||
[switch]$LogToEvent, [string]$EventSource="SVSMSP_Module", [string]$EventLog = "SVS Scripting",
|
||||
,
|
||||
[int]$CustomEventID, [string]$LogFile, [switch]$PassThru
|
||||
)
|
||||
# IDs & colors
|
||||
@@ -340,18 +341,33 @@
|
||||
[ValidateSet("Info","Warning","Error","Success","General")]
|
||||
[string]$Level = "Info",
|
||||
[string]$TaskCategory = "GeneralTask",
|
||||
[switch]$LogToEvent
|
||||
[switch]$LogToEvent,
|
||||
[string]$EventSource = "Script Automation Monkey",
|
||||
[string]$EventLog = "SVS Scripting"
|
||||
)
|
||||
|
||||
if ( Get-Command -Name Write-Log -ErrorAction SilentlyContinue ) {
|
||||
if (Get-Command -Name Write-Log -ErrorAction SilentlyContinue) {
|
||||
# SVSMSP module's Write-Log is available
|
||||
Write-Log -Message $Message -Level $Level -TaskCategory $TaskCategory -LogToEvent:$LogToEvent
|
||||
Write-Log `
|
||||
-Message $Message `
|
||||
-Level $Level `
|
||||
-TaskCategory $TaskCategory `
|
||||
-LogToEvent:$LogToEvent `
|
||||
-EventSource $EventSource `
|
||||
-EventLog $EventLog
|
||||
}
|
||||
else {
|
||||
# fall back to your helper
|
||||
Write-LogHelper -Message $Message -Level $Level -TaskCategory $TaskCategory -LogToEvent:$LogToEvent
|
||||
}
|
||||
# Fall back to your helper
|
||||
Write-LogHelper `
|
||||
-Message $Message `
|
||||
-Level $Level `
|
||||
-TaskCategory $TaskCategory `
|
||||
-LogToEvent:$LogToEvent `
|
||||
-EventSource $EventSource `
|
||||
-EventLog $EventLog
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region Config & Task Definitions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user