PgManager, MyManager: Change log level of SQL queries to debug. Fix MyManager: Wrong query logged when exception occurs.
--- a/mytoolkit/mymanager.py Sun Mar 10 16:14:53 2013 +0100
+++ b/mytoolkit/mymanager.py Fri Mar 15 15:13:42 2013 +0100
@@ -144,12 +144,12 @@
def _log_query(self, query, args):
name = self.connection.name if hasattr(self.connection, 'name') else '-'
- query = self._executed or self.mogrify(query, args)
+ query = self.mogrify(query, args)
if isinstance(query, bytes):
db = self._get_db()
charset = db.character_set_name()
query = query.decode(charset)
- log_sql.info('[%s] %s' % (name, query))
+ log_sql.debug('[%s] %s' % (name, query))
class MyManager:
--- a/pgtoolkit/pgmanager.py Sun Mar 10 16:14:53 2013 +0100
+++ b/pgtoolkit/pgmanager.py Fri Mar 15 15:13:42 2013 +0100
@@ -218,7 +218,7 @@
def _log_query(self, query='?', args=None):
name = self.connection.name if hasattr(self.connection, 'name') else '-'
query = self.query or self.mogrify(query, args)
- log_sql.info('[%s] %s' % (name, query.decode('utf8')))
+ log_sql.debug('[%s] %s' % (name, query.decode('utf8')))
def _log_exception(self):
name = self.connection.name if hasattr(self.connection, 'name') else '-'