zeitgeist team mailing list archive
-
zeitgeist team
-
Mailing list archive
-
Message #01751
Re: [Merge] lp:~zeitgeist/zeitgeist/explain-logs into lp:zeitgeist
Review: Approve
Looks good, and it does not have to be perfect as it is for internal use only, but I'd like to avoid the 'print' statement and put it in a logging statement. This way it would be possible to redirect logging output of the 'zeitgeist.sql' domain to some file etc.
Proposed diff:
=== modified file '_zeitgeist/engine/sql.py'
--- _zeitgeist/engine/sql.py 2010-09-13 20:55:00 +0000
+++ _zeitgeist/engine/sql.py 2010-09-14 07:08:20 +0000
@@ -38,9 +38,10 @@
def explain_query(cursor, statement, arguments=()):
log.debug("**********************************************")
- log.debug("QUERY:\n%s (%s)\nPLAN:" % (statement,arguments))
+ plan = ""
for r in cursor.execute("EXPLAIN QUERY PLAN "+statement, arguments).fetchall():
- print r
+ plan += str(list(r)) + "\n"
+ log.debug("QUERY:\n%s (%s)\nPLAN:\n%s" % (statement,arguments, plan))
log.debug("**********************************************")
class UnicodeCursor(sqlite3.Cursor):
--
https://code.launchpad.net/~zeitgeist/zeitgeist/explain-logs/+merge/35334
Your team Zeitgeist Framework Team is subscribed to branch lp:~zeitgeist/zeitgeist/explain-logs.
References