aboutsummaryrefslogtreecommitdiff
path: root/wqflask/utility/logger.py
diff options
context:
space:
mode:
authorPjotr Prins2016-06-18 07:36:14 +0000
committerPjotr Prins2016-06-18 07:36:14 +0000
commit3a59631a4a95f4b4a1911e3a10912cdcbdf31200 (patch)
treee9de0dd9d919ee5d27b3faa1698a37eeec18cba6 /wqflask/utility/logger.py
parentc93dfd2a6343690fdcfcb4b5dcb231f0ee4dc8fd (diff)
downloadgenenetwork2-3a59631a4a95f4b4a1911e3a10912cdcbdf31200.tar.gz
Logging: behaviours
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