changeset 90:0c22a870bb79

logging proxy update
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 19 Apr 2010 23:03:01 +0200
parents b2c38dee135a
children 25e01cb65282
files pylons_app/lib/timerproxy.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pylons_app/lib/timerproxy.py	Mon Apr 19 22:55:58 2010 +0200
+++ b/pylons_app/lib/timerproxy.py	Mon Apr 19 23:03:01 2010 +0200
@@ -1,7 +1,7 @@
 from sqlalchemy.interfaces import ConnectionProxy
 import time
 import logging
-log = logging.getLogger(__name__)
+log = logging.getLogger('timerproxy')
 
 class TimerProxy(ConnectionProxy):
     def cursor_execute(self, execute, cursor, statement, parameters, context, executemany):
@@ -11,5 +11,8 @@
             return execute(cursor, statement, parameters, context)
         finally:
             total = time.time() - now
-            log.info("Query: %s" % statement % parameters)
+            try:
+                log.info("Query: %s" % statement % parameters)
+            except TypeError:
+                log.info("Query: %s %s" % (statement, parameters))
             log.info("<<<<< TOTAL TIME: %f <<<<<" % total)