aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--voctocore/lib/loghandler.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/voctocore/lib/loghandler.py b/voctocore/lib/loghandler.py
index d2fcb13..f0a60ee 100644
--- a/voctocore/lib/loghandler.py
+++ b/voctocore/lib/loghandler.py
@@ -22,18 +22,17 @@ class LogFormatter(logging.Formatter):
c_lvl = 31
c_mod = 31
c_msg = 31
- if self.timestamps:
- fmt = '%(asctime)s \x1b['+str(c_lvl)+'m%(levelname)8s\x1b[0m \x1b['+str(c_mod)+'m%(name)s\x1b['+str(c_msg)+'m: %(message)s\x1b[0m'
- else:
- fmt = '\x1b['+str(c_lvl)+'m%(levelname)8s\x1b[0m \x1b['+str(c_mod)+'m%(name)s\x1b['+str(c_msg)+'m: %(message)s\x1b[0m'
+
+ fmt = '\x1b['+str(c_lvl)+'m%(levelname)8s\x1b[0m \x1b['+str(c_mod)+'m%(name)s\x1b['+str(c_msg)+'m: %(message)s\x1b[0m'
else:
- if self.timestamps:
- fmt = '%(asctime)s %(levelname)8s %(name)s: %(message)s'
- else:
- fmt = '%(levelname)8s %(name)s: %(message)s'
+ fmt = '%(levelname)8s %(name)s: %(message)s'
+
+ if self.timestamps:
+ fmt = '%(asctime)s '+fmt
if not 'asctime' in record.__dict__:
record.__dict__['asctime']=time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(record.__dict__['created']))
+
return fmt % record.__dict__