From 1c569416d4f8323b641ffe6e037d1c82aa7795ed Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9gory=20Wisniewski?= <gregory@nexedi.com>
Date: Mon, 6 Jul 2009 09:08:43 +0000
Subject: [PATCH] Disable by default MySQL queries logging.

git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@786 71dcc9de-d417-0410-9af5-da40c76e7ee4
---
 neo/storage/mysqldb.py | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/neo/storage/mysqldb.py b/neo/storage/mysqldb.py
index e78bbe40..f1d174f1 100644
--- a/neo/storage/mysqldb.py
+++ b/neo/storage/mysqldb.py
@@ -27,6 +27,8 @@ from neo.storage.database import DatabaseManager
 from neo.exception import DatabaseFailure
 from neo.protocol import DISCARDED_STATE, INVALID_PTID
 
+LOG_QUERIES = False
+
 def p64(n):
     return pack('!Q', n)
 
@@ -79,14 +81,15 @@ class MySQLDatabaseManager(DatabaseManager):
         """Query data from a database."""
         conn = self.conn
         try:
-            printable_char_list = []
-            for c in query.split('\n', 1)[0][:70]:
-                if c not in string.printable or c in '\t\x0b\x0c\r':
-                    c = '\\x%02x' % ord(c)
-                printable_char_list.append(c)
-            query_part = ''.join(printable_char_list)
-
-            logging.debug('querying %s...', query_part)
+            if LOG_QUERIES:
+                printable_char_list = []
+                for c in query.split('\n', 1)[0][:70]:
+                    if c not in string.printable or c in '\t\x0b\x0c\r':
+                        c = '\\x%02x' % ord(c)
+                    printable_char_list.append(c)
+                query_part = ''.join(printable_char_list)
+                logging.debug('querying %s...', query_part)
+
             conn.query(query)
             r = conn.store_result()
             if r is not None:
-- 
2.30.9