icinga-powershell-framework/lib/core/logging/Write-IcingaEventMessage.psm1

25 lines
631 B
PowerShell
Raw Normal View History

function Write-IcingaEventMessage()
{
param(
[int]$EventId = 0,
[string]$Namespace = $null
);
if ($EventId -eq 0 -Or $null -eq $Namespace) {
return;
}
$EntryType = $IcingaEventLogEnums[$Namespace][$EventId].EntryType;
$Message = $IcingaEventLogEnums[$Namespace][$EventId].Message;
if ($null -eq $EntryType -Or $null -eq $Message) {
return;
}
Write-EventLog -LogName Application `
-Source 'Icinga for Windows' `
-EntryType $EntryType `
-EventId $EventId `
-Message $Message;
}