diff --git a/lib/core/logging/Write-IcingaDebugMessage.psm1 b/lib/core/logging/Write-IcingaDebugMessage.psm1 index 473d129..4ba204f 100644 --- a/lib/core/logging/Write-IcingaDebugMessage.psm1 +++ b/lib/core/logging/Write-IcingaDebugMessage.psm1 @@ -4,6 +4,10 @@ function Write-IcingaDebugMessage() [string]$Message ); + if ([string]::IsNullOrEmpty($Message)) { + return; + } + if ($global:IcingaDaemonData.DebugMode -eq $FALSE) { return; } diff --git a/lib/core/logging/Write-IcingaErrorMessage.psm1 b/lib/core/logging/Write-IcingaErrorMessage.psm1 new file mode 100644 index 0000000..a90190f --- /dev/null +++ b/lib/core/logging/Write-IcingaErrorMessage.psm1 @@ -0,0 +1,13 @@ +function Write-IcingaErrorMessage() +{ + param( + [int]$EventId = 0, + [string]$Message = $null + ); + + if ($EventId -eq 0 -Or [string]::IsNullOrEmpty($Message)) { + return; + } + + Write-EventLog -LogName Application -Source 'Icinga for Windows' -EntryType Error -EventId $EventId -Message $Message; +}