From f961a854cc67d8075ac55df3307c4a2f29e3cce7 Mon Sep 17 00:00:00 2001 From: Lord Hepipud Date: Sat, 30 May 2020 12:11:30 +0200 Subject: [PATCH] Fixes debug console output being printed while debugging is disabled --- .../logging/Write-IcingaConsoleDebug.psm1 | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/core/logging/Write-IcingaConsoleDebug.psm1 b/lib/core/logging/Write-IcingaConsoleDebug.psm1 index 717d950..069dbc9 100644 --- a/lib/core/logging/Write-IcingaConsoleDebug.psm1 +++ b/lib/core/logging/Write-IcingaConsoleDebug.psm1 @@ -21,14 +21,18 @@ function Write-IcingaConsoleDebug() { - param ( - [string]$Message, - [array]$Objects - ); + param ( + [string]$Message, + [array]$Objects + ); - Write-IcingaConsoleOutput ` - -Message $Message ` - -Objects $Objects ` - -ForeColor 'Blue' ` - -Severity 'Debug'; + if ((Get-IcingaFrameworkDebugMode) -eq $FALSE) { + return; + } + + Write-IcingaConsoleOutput ` + -Message $Message ` + -Objects $Objects ` + -ForeColor 'Blue' ` + -Severity 'Debug'; }