diff options
author | Pjotr Prins | 2016-06-18 12:14:39 +0000 |
---|---|---|
committer | Pjotr Prins | 2016-06-18 12:14:39 +0000 |
commit | 21d14548c6c3799f36f0997a30a3853344dcc96b (patch) | |
tree | 53059df70834c8758e6a7e8653dbd3881451cb95 /wqflask/utility/logger.py | |
parent | 574aee1d78d1633249cc359e8d91075762365074 (diff) | |
download | genenetwork2-21d14548c6c3799f36f0997a30a3853344dcc96b.tar.gz |
Logging settings
Diffstat (limited to 'wqflask/utility/logger.py')
-rw-r--r-- | wqflask/utility/logger.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/wqflask/utility/logger.py b/wqflask/utility/logger.py index 0549a7fa..479f6c46 100644 --- a/wqflask/utility/logger.py +++ b/wqflask/utility/logger.py @@ -13,6 +13,11 @@ # import utility.logger # logger = utility.logger.getLogger(__name__ ) # +# To override global behaviour set the LOG_LEVEL in default_settings.py +# or use an environment variable, e.g. +# +# env LOG_LEVEL=INFO ./bin/genenetwork2 +# # To override log level for a module replace that with, for example, # # import logging @@ -22,18 +27,16 @@ # We'll add more overrides soon. 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) + else: + logger.setLevel(LOG_LEVEL) + + logger.debug("Log "+name+" at level "+logging.getLevelName(logger.getEffectiveLevel())) return logger |