aboutsummaryrefslogtreecommitdiff
path: root/wqflask/utility
diff options
context:
space:
mode:
authorPjotr Prins2016-06-18 13:04:46 +0000
committerPjotr Prins2016-06-18 13:04:46 +0000
commit2792557c4f978e156a9e92745c4d2c4b3759b507 (patch)
tree6cf6b512ba37fa39acadd0b272569017fd0d0409 /wqflask/utility
parent21d14548c6c3799f36f0997a30a3853344dcc96b (diff)
downloadgenenetwork2-2792557c4f978e156a9e92745c4d2c4b3759b507.tar.gz
Logger: create stub so we can have multiple arguments to log functions
Diffstat (limited to 'wqflask/utility')
-rw-r--r--wqflask/utility/logger.py35
1 files changed, 32 insertions, 3 deletions
diff --git a/wqflask/utility/logger.py b/wqflask/utility/logger.py
index 479f6c46..f0790ab1 100644
--- a/wqflask/utility/logger.py
+++ b/wqflask/utility/logger.py
@@ -27,16 +27,45 @@
# We'll add more overrides soon.
import logging
+import string
from utility.tools import LOG_LEVEL
+class GNLogger:
+ """A stub for multiple parameter logging"""
+
+ def __init__(self,name):
+ self.logger = logging.getLogger(name)
+
+ def setLevel(self,value):
+ self.logger.setLevel(value)
+
+ def debug(self,*args):
+ self.collect(self.logger.debug,*args)
+
+ def info(self,*args):
+ self.collect(self.logger.info,*args)
+
+ def warning(self,*args):
+ self.collect(self.logger.warning,*args)
+ self.logger.warning(self.collect(*args))
+
+ def error(self,*args):
+ self.collect(self.logger.error,*args)
+
+ def collect(self,fun,*args):
+ for a in args:
+ fun(a)
+
# Get the module logger. You can override log levels at the
# module level
def getLogger(name, level = None):
- logger = logging.getLogger(name)
+ gnlogger = GNLogger(name)
+ logger = gnlogger.logger
+
if level:
logger.setLevel(level)
else:
logger.setLevel(LOG_LEVEL)
- logger.debug("Log "+name+" at level "+logging.getLevelName(logger.getEffectiveLevel()))
- return logger
+ logger.debug("Log level of "+name+" set to "+logging.getLevelName(logger.getEffectiveLevel()))
+ return gnlogger