Changeset - 0c22a870bb79
[Not reviewed]
default
0 1 0
Marcin Kuzminski - 16 years ago 2010-04-19 23:03:01
marcin@python-works.com
logging proxy update
1 file changed with 5 insertions and 2 deletions:
0 comments (0 inline, 0 general)
pylons_app/lib/timerproxy.py
Show inline comments
 
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 @@ class TimerProxy(ConnectionProxy):
 
            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)
0 comments (0 inline, 0 general)