about summary refs log tree commit diff
path: root/wqflask/utility/logger.py
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask/utility/logger.py')
-rw-r--r--wqflask/utility/logger.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/wqflask/utility/logger.py b/wqflask/utility/logger.py
index ddc0ea82..bacb0aa4 100644
--- a/wqflask/utility/logger.py
+++ b/wqflask/utility/logger.py
@@ -31,6 +31,7 @@ import string
 from inspect import isfunction
 from pprint import pformat as pf
 from inspect import stack
+import datetime
 
 from utility.tools import LOG_LEVEL, LOG_LEVEL_DEBUG, LOG_SQL, LOG_FORMAT
 
@@ -49,11 +50,20 @@ class GNLogger:
         self.logger.setLevel(value)
 
     def debug(self,*args):
+        """Call logging.debug for multiple args. Use (lazy) debugf and
+level=num to filter on LOG_LEVEL_DEBUG.
+
+        """
+        self.collect(self.logger.debug,*args)
+
+    def debug20(self,*args):
         """Call logging.debug for multiple args. Use level=num to filter on
 LOG_LEVEL_DEBUG (NYI).
 
         """
-        self.collect(self.logger.debug,*args)
+        if level <= LOG_LEVEL_DEBUG:
+            if self.logger.getEffectiveLevel() < 20:
+                self.collect(self.logger.debug,*args)
 
     def info(self,*args):
         """Call logging.info for multiple args"""
@@ -66,7 +76,10 @@ LOG_LEVEL_DEBUG (NYI).
 
     def error(self,*args):
         """Call logging.error for multiple args"""
-        self.collect(self.logger.error,*args)
+        now = datetime.datetime.utcnow()
+        time_str = now.strftime('%H:%M:%S UTC %Y%m%d')
+        l = [time_str]+list(args)
+        self.collect(self.logger.error,*l)
 
     def infof(self,*args):
         """Call logging.info for multiple args lazily"""
@@ -75,7 +88,10 @@ LOG_LEVEL_DEBUG (NYI).
             self.collectf(self.logger.debug,*args)
 
     def debugf(self,level=0,*args):
-        """Call logging.debug for multiple args lazily"""
+        """Call logging.debug for multiple args lazily and handle
+        LOG_LEVEL_DEBUG correctly
+
+        """
         # only evaluate function when logging
         if level <= LOG_LEVEL_DEBUG:
             if self.logger.getEffectiveLevel() < 20: