aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-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