aboutsummaryrefslogtreecommitdiff
path: root/wqflask/utility/logger.py
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask/utility/logger.py')
-rw-r--r--wqflask/utility/logger.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/wqflask/utility/logger.py b/wqflask/utility/logger.py
index 85a64438..6f9d0f96 100644
--- a/wqflask/utility/logger.py
+++ b/wqflask/utility/logger.py
@@ -5,4 +5,22 @@
# settings for log levels (global and by module) and (potentially)
# offers some fine grained log levels for the standard levels.
#
-# Global settings (defined in default_settings.py).
+# All behaviour is defined here. Global settings (defined in
+# default_settings.py).
+
+import logging
+
+from utility.tools import LOG_LEVEL
+
+print("Set global log level to "+LOG_LEVEL)
+
+log_level = getattr(logging, LOG_LEVEL.upper())
+logging.basicConfig(level=log_level)
+
+# Get the module logger. You can override log levels at the
+# module level
+def getLogger(name, level = None):
+ logger = logging.getLogger(name)
+ if level:
+ logger.setLevel(level)
+ return logger