SVN: ZODB/trunk/src/ZEO/zrpc/connection.py Turn off debug logging. It's waaaay too expensive. But make it not too

Jim Fulton <[email protected]>
Newsgroups gmane.comp.python.zope.zodb.cvs
Message-ID <20091218195433.C229B7083BC__37247.9366291829$1261166144$gmane$org@cvs.zope.org>
Log message for revision 106764:
  Turn off debug logging. It's waaaay too expensive. But make it not too
  hard to turn back on when it's needed, although, at that poiint, it
  still might not be enough. :)
  

Changed:
  U   ZODB/trunk/src/ZEO/zrpc/connection.py

-=-
Modified: ZODB/trunk/src/ZEO/zrpc/connection.py
===================================================================
--- ZODB/trunk/src/ZEO/zrpc/connection.py	2009-12-18 13:52:12 UTC (rev 106763)
+++ ZODB/trunk/src/ZEO/zrpc/connection.py	2009-12-18 19:54:33 UTC (rev 106764)
@@ -34,6 +34,8 @@
 
 exception_type_type = type(Exception)
 
+debug_zrpc = False
+
 ##############################################################################
 # Dedicated Client select loop:
 client_timeout = 30.0
@@ -537,7 +539,7 @@
         # close the connection.
         msgid, flags, name, args = self.marshal.decode(message)
 
-        if __debug__:
+        if debug_zrpc:
             self.log("recv msg: %s, %s, %s, %s" % (msgid, flags, name,
                                                    short_repr(args)),
                      level=TRACE)
@@ -547,7 +549,7 @@
             self.handle_request(msgid, flags, name, args)
 
     def handle_reply(self, msgid, flags, args):
-        if __debug__:
+        if debug_zrpc:
             self.log("recv reply: %s, %s, %s"
                      % (msgid, flags, short_repr(args)), level=TRACE)
         self.replies_cond.acquire()
@@ -562,7 +564,7 @@
 
         if name.startswith('_') or not hasattr(obj, name):
             if obj is None:
-                if __debug__:
+                if debug_zrpc:
                     self.log("no object calling %s%s"
                              % (name, short_repr(args)),
                              level=logging.DEBUG)
@@ -570,7 +572,7 @@
 
             msg = "Invalid method name: %s on %s" % (name, repr(obj))
             raise ZRPCError(msg)
-        if __debug__:
+        if debug_zrpc:
             self.log("calling %s%s" % (name, short_repr(args)),
                      level=logging.DEBUG)
 
@@ -595,7 +597,7 @@
                 raise ZRPCError("async method %s returned value %s" %
                                 (name, short_repr(ret)))
         else:
-            if __debug__:
+            if debug_zrpc:
                 self.log("%s returns %s" % (name, short_repr(ret)),
                          logging.DEBUG)
             if isinstance(ret, Delay):
@@ -676,7 +678,7 @@
     def __call_message(self, method, args, flags):
         # compute a message and return it
         msgid = self.__new_msgid()
-        if __debug__:
+        if debug_zrpc:
             self.log("send msg: %d, %d, %s, ..." % (msgid, flags, method),
                      level=TRACE)
         return self.marshal.encode(msgid, flags, method, args)
@@ -684,7 +686,7 @@
     def send_call(self, method, args, flags):
         # send a message and return its msgid
         msgid = self.__new_msgid()
-        if __debug__:
+        if debug_zrpc:
             self.log("send msg: %d, %d, %s, ..." % (msgid, flags, method),
                      level=TRACE)
         buf = self.marshal.encode(msgid, flags, method, args)
@@ -753,7 +755,7 @@
 
     def wait(self, msgid):
         """Invoke asyncore mainloop and wait for reply."""
-        if __debug__:
+        if debug_zrpc:
             self.log("wait(%d)" % msgid, level=TRACE)
 
         self.trigger.pull_trigger()
@@ -770,7 +772,7 @@
                 reply = self.replies.get(msgid)
                 if reply is not None:
                     del self.replies[msgid]
-                    if __debug__:
+                    if debug_zrpc:
                         self.log("wait(%d): reply=%s" %
                                  (msgid, short_repr(reply)), level=TRACE)
                     return reply
@@ -780,14 +782,14 @@
 
     def flush(self):
         """Invoke poll() until the output buffer is empty."""
-        if __debug__:
+        if debug_zrpc:
             self.log("flush")
         while self.writable():
             self.poll()
 
     def poll(self):
         """Invoke asyncore mainloop to get pending message out."""
-        if __debug__:
+        if debug_zrpc:
             self.log("poll()", level=TRACE)
         self.trigger.pull_trigger()
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.