Commit 38bdc708 authored by Julien Muchembled's avatar Julien Muchembled

logs: increase time resolution (.1 ms instead of 1 ms)

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2701 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent e87f0d61
......@@ -21,6 +21,12 @@ import logging as logging_std
PREFIX = '%(asctime)s %(levelname)-9s %(name)-10s'
SUFFIX = ' [%(module)14s:%(lineno)3d] %(message)s'
class Formatter(logging_std.Formatter):
def formatTime(self, record, datefmt=None):
return logging_std.Formatter.formatTime(self, record,
'%Y-%m-%d %H:%M:%S') + '.%04d' % (record.msecs * 10)
def setupLog(name='NEO', filename=None, verbose=False):
global logging
if verbose:
......@@ -35,7 +41,7 @@ def setupLog(name='NEO', filename=None, verbose=False):
handler = logging_std.StreamHandler()
else:
handler = logging_std.FileHandler(filename)
handler.setFormatter(logging_std.Formatter(fmt))
handler.setFormatter(Formatter(fmt))
logging.setLevel(level)
logging.addHandler(handler)
logging.propagate = 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment