mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
Adds unified debug message output with object parsing ability
This commit is contained in:
parent
699137a97c
commit
e8f2152010
2 changed files with 12 additions and 3 deletions
|
|
@ -7,7 +7,12 @@
|
||||||
#>
|
#>
|
||||||
[hashtable]$IcingaEventLogEnums += @{
|
[hashtable]$IcingaEventLogEnums += @{
|
||||||
'Framework' = @{
|
'Framework' = @{
|
||||||
# TODO: Add event log messages
|
1000 = @{
|
||||||
|
'EntryType' = 'Information';
|
||||||
|
'Message' = 'Generic debug message issued by the Framework or its components';
|
||||||
|
'Details' = 'The Framework or is components can issue generic debug message in case the debug log is enabled. Please ensure to disable it, if not used. You can do so with the command "Disable-IcingaFrameworkDebugMode"';
|
||||||
|
'EventId' = 1000;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
function Write-IcingaDebugMessage()
|
function Write-IcingaDebugMessage()
|
||||||
{
|
{
|
||||||
param(
|
param(
|
||||||
[string]$Message
|
[string]$Message,
|
||||||
|
[array]$Objects = @()
|
||||||
);
|
);
|
||||||
|
|
||||||
if ([string]::IsNullOrEmpty($Message)) {
|
if ([string]::IsNullOrEmpty($Message)) {
|
||||||
|
|
@ -12,5 +13,8 @@ function Write-IcingaDebugMessage()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-EventLog -LogName Application -Source 'Icinga for Windows' -EntryType Information -EventId 1000 -Message $Message;
|
[array]$DebugContent = @($Message);
|
||||||
|
$DebugContent += $Objects;
|
||||||
|
|
||||||
|
Write-IcingaEventMessage -EventId 1000 -Namespace 'Framework' -Objects $DebugContent;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue