changeset 1191:1fb97030b9b7 beta

let timerproxy use logging module
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 01 Apr 2011 16:35:03 +0200
parents 0d7a127e6449
children 01fe71db71f6
files rhodecode/lib/timerproxy.py
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/timerproxy.py	Thu Mar 31 08:00:24 2011 +0200
+++ b/rhodecode/lib/timerproxy.py	Fri Apr 01 16:35:03 2011 +0200
@@ -1,6 +1,8 @@
 from sqlalchemy.interfaces import ConnectionProxy
 import time
-from sqlalchemy import log
+import logging
+log = logging.getLogger('timerproxy')
+
 BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = xrange(30, 38)
 
 def color_sql(sql):
@@ -13,16 +15,14 @@
 
     def __init__(self):
         super(TimerProxy, self).__init__()
-        self.logging_name = 'timerProxy'
-        self.log = log.instance_logger(self, True)
 
     def cursor_execute(self, execute, cursor, statement, parameters,
                        context, executemany):
 
         now = time.time()
         try:
-            self.log.info(color_sql(">>>>> STARTING QUERY >>>>>"))
+            log.info(color_sql(">>>>> STARTING QUERY >>>>>"))
             return execute(cursor, statement, parameters, context)
         finally:
             total = time.time() - now
-            self.log.info(color_sql("<<<<< TOTAL TIME: %f <<<<<" % total))
+            log.info(color_sql("<<<<< TOTAL TIME: %f <<<<<" % total))