From 77892b10591bc39221c4ab0a35e03f0d2eb54542 Mon Sep 17 00:00:00 2001
From: Marko Mecina <marko.mecina@univie.ac.at>
Date: Wed, 27 Apr 2022 14:58:42 +0200
Subject: [PATCH] make logging level in cofingnator configurable

---
 Tst/confignator/Makefile              | 6 ++++--
 Tst/confignator/confignator/config.py | 3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Tst/confignator/Makefile b/Tst/confignator/Makefile
index 52c50f1..0475e8d 100644
--- a/Tst/confignator/Makefile
+++ b/Tst/confignator/Makefile
@@ -25,12 +25,14 @@ build:
 		rm -f $(CONFIGNATOR_CFG)
 		# create the new file containing the path to the configuration file
 		@echo "# This is the configuration file for the confignator and is a generated file, created during the installation of the confignator package." >> $(CONFIGNATOR_CFG)
-		@echo "# Modifications have to be done in the Makefile of the confignator package and a reinstall of it is needed!\n" >> $(CONFIGNATOR_CFG)
+		@echo -e "# Modifications have to be done in the Makefile of the confignator package and a reinstall of it is needed!\n" >> $(CONFIGNATOR_CFG)
 		@echo "[confignator-paths]" >> $(CONFIGNATOR_CFG)
 		@echo "basic-path = $(BASIC_PATH)" >> $(CONFIGNATOR_CFG)
 		@echo "basic-cfg = $(BASIC_CONFI_CFG)" >> $(CONFIGNATOR_CFG)
 		@echo "docu = $(DOCU_INDEX_HTML)" >> $(CONFIGNATOR_CFG)
-		@echo "log-file = ''\n" >> $(CONFIGNATOR_CFG)
+		@echo -e "log-file = ''\n" >> $(CONFIGNATOR_CFG)
+		@echo "[confignator-logging]" >> $(CONFIGNATOR_CFG)
+		@echo -e "level = INFO\n" >> $(CONFIGNATOR_CFG)
 		# build the Python package
 		# python3 setup.py sdist;
 		python3 setup.py bdist_wheel
diff --git a/Tst/confignator/confignator/config.py b/Tst/confignator/confignator/config.py
index 72f1e93..bc12e3a 100755
--- a/Tst/confignator/confignator/config.py
+++ b/Tst/confignator/confignator/config.py
@@ -76,7 +76,8 @@ logging_format = fmt
 logging_level_file = logging.INFO
 logging_level_console = logging.WARNING
 module_logger = logging.getLogger(__name__)
-module_logger.setLevel(logging.DEBUG)
+# module_logger.setLevel(logging.INFO)
+module_logger.setLevel(getattr(logging, cfg.get('confignator-logging', 'level')))
 logging_file_name = 'confignator.log'
 
 
-- 
GitLab