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 ...@@ -34,6 +34,8 @@ ASYNC = 1
exception_type_type = type(Exception) exception_type_type = type(Exception)
debug_zrpc = False
############################################################################## ##############################################################################
# Dedicated Client select loop: # Dedicated Client select loop:
client_timeout = 30.0 client_timeout = 30.0
...@@ -537,7 +539,7 @@ class Connection(smac.SizedMessageAsyncConnection, object): ...@@ -537,7 +539,7 @@ class Connection(smac.SizedMessageAsyncConnection, object):
# close the connection. # close the connection.
msgid, flags, name, args = self.marshal.decode(message) msgid, flags, name, args = self.marshal.decode(message)
if __debug__: if debug_zrpc:
self.log("recv msg: %s, %s, %s, %s" % (msgid, flags, name, self.log("recv msg: %s, %s, %s, %s" % (msgid, flags, name,
short_repr(args)), short_repr(args)),
level=TRACE) level=TRACE)
...@@ -547,7 +549,7 @@ class Connection(smac.SizedMessageAsyncConnection, object): ...@@ -547,7 +549,7 @@ class Connection(smac.SizedMessageAsyncConnection, object):
self.handle_request(msgid, flags, name, args) self.handle_request(msgid, flags, name, args)
def handle_reply(self, msgid, flags, args): def handle_reply(self, msgid, flags, args):
if __debug__: if debug_zrpc:
self.log("recv reply: %s, %s, %s" self.log("recv reply: %s, %s, %s"
% (msgid, flags, short_repr(args)), level=TRACE) % (msgid, flags, short_repr(args)), level=TRACE)
self.replies_cond.acquire() self.replies_cond.acquire()
...@@ -562,7 +564,7 @@ class Connection(smac.SizedMessageAsyncConnection, object): ...@@ -562,7 +564,7 @@ class Connection(smac.SizedMessageAsyncConnection, object):
if name.startswith('_') or not hasattr(obj, name): if name.startswith('_') or not hasattr(obj, name):
if obj is None: if obj is None:
if __debug__: if debug_zrpc:
self.log("no object calling %s%s" self.log("no object calling %s%s"
% (name, short_repr(args)), % (name, short_repr(args)),
level=logging.DEBUG) level=logging.DEBUG)
...@@ -570,7 +572,7 @@ class Connection(smac.SizedMessageAsyncConnection, object): ...@@ -570,7 +572,7 @@ class Connection(smac.SizedMessageAsyncConnection, object):
msg = "Invalid method name: %s on %s" % (name, repr(obj)) msg = "Invalid method name: %s on %s" % (name, repr(obj))
raise ZRPCError(msg) raise ZRPCError(msg)
if __debug__: if debug_zrpc:
self.log("calling %s%s" % (name, short_repr(args)), self.log("calling %s%s" % (name, short_repr(args)),
level=logging.DEBUG) level=logging.DEBUG)
...@@ -595,7 +597,7 @@ class Connection(smac.SizedMessageAsyncConnection, object): ...@@ -595,7 +597,7 @@ class Connection(smac.SizedMessageAsyncConnection, object):
raise ZRPCError("async method %s returned value %s" % raise ZRPCError("async method %s returned value %s" %
(name, short_repr(ret))) (name, short_repr(ret)))
else: else:
if __debug__: if debug_zrpc:
self.log("%s returns %s" % (name, short_repr(ret)), self.log("%s returns %s" % (name, short_repr(ret)),
logging.DEBUG) logging.DEBUG)
if isinstance(ret, Delay): if isinstance(ret, Delay):
...@@ -676,7 +678,7 @@ class Connection(smac.SizedMessageAsyncConnection, object): ...@@ -676,7 +678,7 @@ class Connection(smac.SizedMessageAsyncConnection, object):
def __call_message(self, method, args, flags): def __call_message(self, method, args, flags):
# compute a message and return it # compute a message and return it
msgid = self.__new_msgid() msgid = self.__new_msgid()
if __debug__: if debug_zrpc:
self.log("send msg: %d, %d, %s, ..." % (msgid, flags, method), self.log("send msg: %d, %d, %s, ..." % (msgid, flags, method),
level=TRACE) level=TRACE)
return self.marshal.encode(msgid, flags, method, args) return self.marshal.encode(msgid, flags, method, args)
...@@ -684,7 +686,7 @@ class Connection(smac.SizedMessageAsyncConnection, object): ...@@ -684,7 +686,7 @@ class Connection(smac.SizedMessageAsyncConnection, object):
def send_call(self, method, args, flags): def send_call(self, method, args, flags):
# send a message and return its msgid # send a message and return its msgid
msgid = self.__new_msgid() msgid = self.__new_msgid()
if __debug__: if debug_zrpc:
self.log("send msg: %d, %d, %s, ..." % (msgid, flags, method), self.log("send msg: %d, %d, %s, ..." % (msgid, flags, method),
level=TRACE) level=TRACE)
buf = self.marshal.encode(msgid, flags, method, args) buf = self.marshal.encode(msgid, flags, method, args)
...@@ -753,7 +755,7 @@ class Connection(smac.SizedMessageAsyncConnection, object): ...@@ -753,7 +755,7 @@ class Connection(smac.SizedMessageAsyncConnection, object):
def wait(self, msgid): def wait(self, msgid):
"""Invoke asyncore mainloop and wait for reply.""" """Invoke asyncore mainloop and wait for reply."""
if __debug__: if debug_zrpc:
self.log("wait(%d)" % msgid, level=TRACE) self.log("wait(%d)" % msgid, level=TRACE)
self.trigger.pull_trigger() self.trigger.pull_trigger()
...@@ -770,7 +772,7 @@ class Connection(smac.SizedMessageAsyncConnection, object): ...@@ -770,7 +772,7 @@ class Connection(smac.SizedMessageAsyncConnection, object):
reply = self.replies.get(msgid) reply = self.replies.get(msgid)
if reply is not None: if reply is not None:
del self.replies[msgid] del self.replies[msgid]
if __debug__: if debug_zrpc:
self.log("wait(%d): reply=%s" % self.log("wait(%d): reply=%s" %
(msgid, short_repr(reply)), level=TRACE) (msgid, short_repr(reply)), level=TRACE)
return reply return reply
...@@ -780,14 +782,14 @@ class Connection(smac.SizedMessageAsyncConnection, object): ...@@ -780,14 +782,14 @@ class Connection(smac.SizedMessageAsyncConnection, object):
def flush(self): def flush(self):
"""Invoke poll() until the output buffer is empty.""" """Invoke poll() until the output buffer is empty."""
if __debug__: if debug_zrpc:
self.log("flush") self.log("flush")
while self.writable(): while self.writable():
self.poll() self.poll()
def poll(self): def poll(self):
"""Invoke asyncore mainloop to get pending message out.""" """Invoke asyncore mainloop to get pending message out."""
if __debug__: if debug_zrpc:
self.log("poll()", level=TRACE) self.log("poll()", level=TRACE)
self.trigger.pull_trigger() 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