Commit fbf736b2 authored by Jim Fulton's avatar Jim Fulton

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. :)
parent a9cda7fb
......@@ -34,6 +34,8 @@ ASYNC = 1
exception_type_type = type(Exception)
debug_zrpc = False
##############################################################################
# Dedicated Client select loop:
client_timeout = 30.0
......@@ -537,7 +539,7 @@ class Connection(smac.SizedMessageAsyncConnection, object):
# 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 @@ class Connection(smac.SizedMessageAsyncConnection, object):
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 @@ class Connection(smac.SizedMessageAsyncConnection, object):
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 @@ class Connection(smac.SizedMessageAsyncConnection, object):
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 @@ class Connection(smac.SizedMessageAsyncConnection, object):
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 @@ class Connection(smac.SizedMessageAsyncConnection, object):
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 @@ class Connection(smac.SizedMessageAsyncConnection, object):
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 @@ class Connection(smac.SizedMessageAsyncConnection, object):
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 @@ class Connection(smac.SizedMessageAsyncConnection, object):
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 @@ class Connection(smac.SizedMessageAsyncConnection, object):
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()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment