From 8cb87fefa69ffe99e22882b338c3a2232a5a7374 Mon Sep 17 00:00:00 2001
From: Jorrit Schaap <schaap@astron.nl>
Date: Mon, 31 Mar 2025 13:42:39 +0200
Subject: [PATCH] TMSS-3182: added common configure_logging_and_timezone method

---
 tmss_pycommon/util.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tmss_pycommon/util.py b/tmss_pycommon/util.py
index cfce099..b4fc408 100644
--- a/tmss_pycommon/util.py
+++ b/tmss_pycommon/util.py
@@ -299,3 +299,10 @@ def without_keys(org_dict: dict, keys: typing.Collection) -> dict:
 def noop():
     '''classic noop (no-operation) function that does nothing.'''
     pass
+
+
+def configure_logging_and_timezone(debug_log_level: bool=False):
+    '''common method to have the same logging and timezone'''
+    # make sure we run in UTC timezone
+    os.environ['TZ'] = 'UTC'
+    logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', level=logging.DEBUG if debug_log_level else logging.INFO)
-- 
GitLab