From 38bdc7080f8db042fc09f9792d7ae1e694f3e579 Mon Sep 17 00:00:00 2001
From: Julien Muchembled <jm@nexedi.com>
Date: Thu, 7 Apr 2011 13:02:25 +0000
Subject: [PATCH] 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
---
 neo/lib/__init__.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/neo/lib/__init__.py b/neo/lib/__init__.py
index 449fc0a2..64ec8894 100644
--- a/neo/lib/__init__.py
+++ b/neo/lib/__init__.py
@@ -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
-- 
2.30.9