From 95e2ca490b9c034b4e9cc94ed1637c3bbd097e23 Mon Sep 17 00:00:00 2001
From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch>
Date: Thu, 14 Dec 2017 09:48:25 +0100
Subject: [PATCH] Make debug logging configurable.

---
 Updater/Update-Service.ps1            | 6 +++---
 Updater/UpdaterConfig-Example.inc.ps1 | 1 +
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/Updater/Update-Service.ps1 b/Updater/Update-Service.ps1
index b51ad56..6657a90 100644
--- a/Updater/Update-Service.ps1
+++ b/Updater/Update-Service.ps1
@@ -368,9 +368,9 @@ function Log-Info([string]$Message) {
 
 function Log-Debug([string]$Message) {
     Write-Verbose $Message
-    # NOTE: to disable debug logging simply uncomment the "Return" below:
-    # Return
-    Log-Message -Type Information -Message $Message -Id 999
+    if ($UpdaterDebugLogging) {
+        Log-Message -Type Information -Message $Message -Id 1000
+    }
 }
 
 ################################################################################
diff --git a/Updater/UpdaterConfig-Example.inc.ps1 b/Updater/UpdaterConfig-Example.inc.ps1
index 6c3d3e6..9003870 100644
--- a/Updater/UpdaterConfig-Example.inc.ps1
+++ b/Updater/UpdaterConfig-Example.inc.ps1
@@ -8,6 +8,7 @@ $LogPath = "$($InstallationPath)"
 $UpdateSourcePath = "\\fileserver.mydomain.xy\share\_AUTOTX_"
 $Pattern = 'build_[0-9]{4}-[0-9]{2}-[0-9]{2}_'
 
+$UpdaterDebugLogging = $False
 $EmailFrom = "admin@mydomain.xy"
 $EmailTo   = "admin@mydomain.xy"
 $EmailSMTP = "smtp.mydomain.xy"
\ No newline at end of file
-- 
GitLab