From 429c94d6a90b6f2ae35fa158e7abe04814edd5ef Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Sat, 19 Nov 2011 12:07:57 -0800 Subject: Tidy up logging calls. --- sleekxmpp/plugins/gmail_notify.py | 4 ++-- sleekxmpp/plugins/jobs.py | 2 +- sleekxmpp/plugins/xep_0009/remote.py | 16 ++++++++-------- sleekxmpp/plugins/xep_0009/rpc.py | 8 ++++---- sleekxmpp/plugins/xep_0012.py | 4 ++-- sleekxmpp/plugins/xep_0030/disco.py | 10 +++++----- sleekxmpp/plugins/xep_0045.py | 4 ++-- sleekxmpp/plugins/xep_0050/adhoc.py | 2 +- sleekxmpp/plugins/xep_0078/legacyauth.py | 4 ++-- sleekxmpp/plugins/xep_0085/chat_states.py | 2 +- sleekxmpp/plugins/xep_0199/ping.py | 6 +++--- sleekxmpp/plugins/xep_0224/attention.py | 2 +- 12 files changed, 32 insertions(+), 32 deletions(-) (limited to 'sleekxmpp/plugins') diff --git a/sleekxmpp/plugins/gmail_notify.py b/sleekxmpp/plugins/gmail_notify.py index f6391ac6..fc97a2ab 100644 --- a/sleekxmpp/plugins/gmail_notify.py +++ b/sleekxmpp/plugins/gmail_notify.py @@ -121,7 +121,7 @@ class gmail_notify(base.base_plugin): def handle_gmail(self, iq): mailbox = iq['mailbox'] approx = ' approximately' if mailbox['estimated'] else '' - log.info('Gmail: Received%s %s emails' , approx, mailbox['total-matched']) + log.info('Gmail: Received%s %s emails', approx, mailbox['total-matched']) self.last_result_time = mailbox['result-time'] self.xmpp.event('gmail_messages', iq) @@ -140,7 +140,7 @@ class gmail_notify(base.base_plugin): if query is None: log.info("Gmail: Checking for new emails") else: - log.info('Gmail: Searching for emails matching: "%s"' , query) + log.info('Gmail: Searching for emails matching: "%s"', query) iq = self.xmpp.Iq() iq['type'] = 'get' iq['to'] = self.xmpp.boundjid.bare diff --git a/sleekxmpp/plugins/jobs.py b/sleekxmpp/plugins/jobs.py index 5ccfe271..cb9deba8 100644 --- a/sleekxmpp/plugins/jobs.py +++ b/sleekxmpp/plugins/jobs.py @@ -43,7 +43,7 @@ class jobs(base.base_plugin): iq['psstate']['payload'] = state result = iq.send() if result is None or type(result) == bool or result['type'] != 'result': - log.error("Unable to change %s:%s to %s" , node, jobid, state) + log.error("Unable to change %s:%s to %s", node, jobid, state) return False return True diff --git a/sleekxmpp/plugins/xep_0009/remote.py b/sleekxmpp/plugins/xep_0009/remote.py index 6ca42d08..1e3b504a 100644 --- a/sleekxmpp/plugins/xep_0009/remote.py +++ b/sleekxmpp/plugins/xep_0009/remote.py @@ -20,7 +20,7 @@ log = logging.getLogger(__name__) def _intercept(method, name, public): def _resolver(instance, *args, **kwargs): - log.debug("Locally calling %s.%s with arguments %s." , instance.FQN(), method.__name__, args) + log.debug("Locally calling %s.%s with arguments %s.", instance.FQN(), method.__name__, args) try: value = method(instance, *args, **kwargs) if value == NotImplemented: @@ -381,7 +381,7 @@ class Proxy(Endpoint): try: if attribute._rpc: def _remote_call(*args, **kwargs): - log.debug("Remotely calling '%s.%s' with arguments %s." , self._endpoint.FQN(), attribute._rpc_name, args) + log.debug("Remotely calling '%s.%s' with arguments %s.", self._endpoint.FQN(), attribute._rpc_name, args) return self._endpoint.session._call_remote(self._endpoint.target_jid, "%s.%s" % (self._endpoint.FQN(), attribute._rpc_name), self._callback, *args, **kwargs) return _remote_call except: @@ -449,7 +449,7 @@ class RemoteSession(object): self._event.wait() def _notify(self, event): - log.debug("RPC Session as %s started." , self._client.boundjid.full) + log.debug("RPC Session as %s started.", self._client.boundjid.full) self._client.sendPresence() self._event.set() pass @@ -461,7 +461,7 @@ class RemoteSession(object): if name is None: name = method.__name__ key = "%s.%s" % (endpoint, name) - log.debug("Registering call handler for %s (%s)." , key, method) + log.debug("Registering call handler for %s (%s).", key, method) with self._lock: if key in self._entries: raise KeyError("A handler for %s has already been regisered!" % endpoint) @@ -469,7 +469,7 @@ class RemoteSession(object): return key def _register_acl(self, endpoint, acl): - log.debug("Registering ACL %s for endpoint %s." , repr(acl), endpoint) + log.debug("Registering ACL %s for endpoint %s.", repr(acl), endpoint) with self._lock: self._acls[endpoint] = acl @@ -562,7 +562,7 @@ class RemoteSession(object): iq.send() return future.get_value(30) else: - log.debug("[RemoteSession] _call_remote %s" , callback) + log.debug("[RemoteSession] _call_remote %s", callback) self._register_callback(pid, callback) iq.send() @@ -601,11 +601,11 @@ class RemoteSession(object): error.send() except Exception as e: if isinstance(e, KeyError): - log.error("No handler available for %s!" , pmethod) + log.error("No handler available for %s!", pmethod) error = self._client.plugin['xep_0009']._item_not_found(iq) else: traceback.print_exc(file=sys.stderr) - log.error("An unexpected problem occurred invoking method %s!" , pmethod) + log.error("An unexpected problem occurred invoking method %s!", pmethod) error = self._client.plugin['xep_0009']._undefined_condition(iq) #! print "[REMOTE.PY] _handle_remote_procedure_call AN ERROR SHOULD BE SENT NOW %s " % e error.send() diff --git a/sleekxmpp/plugins/xep_0009/rpc.py b/sleekxmpp/plugins/xep_0009/rpc.py index 7f150511..4f749f30 100644 --- a/sleekxmpp/plugins/xep_0009/rpc.py +++ b/sleekxmpp/plugins/xep_0009/rpc.py @@ -128,22 +128,22 @@ class xep_0009(base.base_plugin): def _handle_method_call(self, iq): type = iq['type'] if type == 'set': - log.debug("Incoming Jabber-RPC call from %s" , iq['from']) + log.debug("Incoming Jabber-RPC call from %s", iq['from']) self.xmpp.event('jabber_rpc_method_call', iq) else: if type == 'error' and ['rpc_query'] is None: self.handle_error(iq) else: - log.debug("Incoming Jabber-RPC error from %s" , iq['from']) + log.debug("Incoming Jabber-RPC error from %s", iq['from']) self.xmpp.event('jabber_rpc_error', iq) def _handle_method_response(self, iq): if iq['rpc_query']['method_response']['fault'] is not None: - log.debug("Incoming Jabber-RPC fault from %s" , iq['from']) + log.debug("Incoming Jabber-RPC fault from %s", iq['from']) #self._on_jabber_rpc_method_fault(iq) self.xmpp.event('jabber_rpc_method_fault', iq) else: - log.debug("Incoming Jabber-RPC response from %s" , iq['from']) + log.debug("Incoming Jabber-RPC response from %s", iq['from']) self.xmpp.event('jabber_rpc_method_response', iq) def _handle_error(self, iq): diff --git a/sleekxmpp/plugins/xep_0012.py b/sleekxmpp/plugins/xep_0012.py index e865cf19..c5532bd4 100644 --- a/sleekxmpp/plugins/xep_0012.py +++ b/sleekxmpp/plugins/xep_0012.py @@ -71,10 +71,10 @@ class xep_0012(base.base_plugin): def handle_last_activity_query(self, iq): if iq['type'] == 'get': - log.debug("Last activity requested by %s" , iq['from']) + log.debug("Last activity requested by %s", iq['from']) self.xmpp.event('last_activity_request', iq) elif iq['type'] == 'result': - log.debug("Last activity result from %s" , iq['from']) + log.debug("Last activity result from %s", iq['from']) self.xmpp.event('last_activity', iq) def handle_last_activity(self, iq): diff --git a/sleekxmpp/plugins/xep_0030/disco.py b/sleekxmpp/plugins/xep_0030/disco.py index 83d7a9c0..04c18a15 100644 --- a/sleekxmpp/plugins/xep_0030/disco.py +++ b/sleekxmpp/plugins/xep_0030/disco.py @@ -268,7 +268,7 @@ class xep_0030(base_plugin): """ if local or jid is None: log.debug("Looking up local disco#info data " + \ - "for %s, node %s." % (jid, node)) + "for %s, node %s.", jid, node) info = self._run_node_handler('get_info', jid, node, kwargs) return self._fix_default_info(info) @@ -542,7 +542,7 @@ class xep_0030(base_plugin): """ if iq['type'] == 'get': log.debug("Received disco info query from " + \ - "<%s> to <%s>." % (iq['from'], iq['to'])) + "<%s> to <%s>.", iq['from'], iq['to']) if self.xmpp.is_component: jid = iq['to'].full else: @@ -558,7 +558,7 @@ class xep_0030(base_plugin): iq.send() elif iq['type'] == 'result': log.debug("Received disco info result from" + \ - "%s to %s." % (iq['from'], iq['to'])) + "%s to %s.", iq['from'], iq['to']) self.xmpp.event('disco_info', iq) def _handle_disco_items(self, iq): @@ -572,7 +572,7 @@ class xep_0030(base_plugin): """ if iq['type'] == 'get': log.debug("Received disco items query from " + \ - "<%s> to <%s>." % (iq['from'], iq['to'])) + "<%s> to <%s>.", iq['from'], iq['to']) if self.xmpp.is_component: jid = iq['to'].full else: @@ -586,7 +586,7 @@ class xep_0030(base_plugin): iq.send() elif iq['type'] == 'result': log.debug("Received disco items result from" + \ - "%s to %s." % (iq['from'], iq['to'])) + "%s to %s.", iq['from'], iq['to']) self.xmpp.event('disco_items', iq) def _fix_default_info(self, info): diff --git a/sleekxmpp/plugins/xep_0045.py b/sleekxmpp/plugins/xep_0045.py index c037297e..ab3f750a 100644 --- a/sleekxmpp/plugins/xep_0045.py +++ b/sleekxmpp/plugins/xep_0045.py @@ -127,7 +127,7 @@ class xep_0045(base.base_plugin): def handle_groupchat_invite(self, inv): """ Handle an invite into a muc. """ - logging.debug("MUC invite to %s from %s: %s" , inv['from'], inv["from"], inv) + logging.debug("MUC invite to %s from %s: %s", inv['from'], inv["from"], inv) if inv['from'] not in self.rooms.keys(): self.xmpp.event("groupchat_invite", inv) @@ -149,7 +149,7 @@ class xep_0045(base.base_plugin): if entry['nick'] not in self.rooms[entry['room']]: got_online = True self.rooms[entry['room']][entry['nick']] = entry - log.debug("MUC presence from %s/%s : %s" , entry['room'],entry['nick'], entry) + log.debug("MUC presence from %s/%s : %s", entry['room'],entry['nick'], entry) self.xmpp.event("groupchat_presence", pr) self.xmpp.event("muc::%s::presence" % entry['room'], pr) if got_offline: diff --git a/sleekxmpp/plugins/xep_0050/adhoc.py b/sleekxmpp/plugins/xep_0050/adhoc.py index 7cfaa0e0..0509f8cf 100644 --- a/sleekxmpp/plugins/xep_0050/adhoc.py +++ b/sleekxmpp/plugins/xep_0050/adhoc.py @@ -211,7 +211,7 @@ class xep_0050(base_plugin): key = (iq['to'].full, node) name, handler = self.commands.get(key, ('Not found', None)) if not handler: - log.debug('Command not found: %s, %s' , key, self.commands) + log.debug('Command not found: %s, %s', key, self.commands) initial_session = {'id': sessionid, 'from': iq['from'], 'to': iq['to'], diff --git a/sleekxmpp/plugins/xep_0078/legacyauth.py b/sleekxmpp/plugins/xep_0078/legacyauth.py index 49634462..dec775a3 100644 --- a/sleekxmpp/plugins/xep_0078/legacyauth.py +++ b/sleekxmpp/plugins/xep_0078/legacyauth.py @@ -60,12 +60,12 @@ class xep_0078(base_plugin): try: resp = iq.send(now=True) except IqError: - log.info("Authentication failed: %s" , resp['error']['condition']) + log.info("Authentication failed: %s", resp['error']['condition']) self.xmpp.event('failed_auth', direct=True) self.xmpp.disconnect() return True except IqTimeout: - log.info("Authentication failed: %s" , 'timeout') + log.info("Authentication failed: %s", 'timeout') self.xmpp.event('failed_auth', direct=True) self.xmpp.disconnect() return True diff --git a/sleekxmpp/plugins/xep_0085/chat_states.py b/sleekxmpp/plugins/xep_0085/chat_states.py index d0a05cc9..e95434d2 100644 --- a/sleekxmpp/plugins/xep_0085/chat_states.py +++ b/sleekxmpp/plugins/xep_0085/chat_states.py @@ -45,5 +45,5 @@ class xep_0085(base_plugin): def _handle_chat_state(self, msg): state = msg['chat_state'] - log.debug("Chat State: %s, %s" , state, msg['from'].jid) + log.debug("Chat State: %s, %s", state, msg['from'].jid) self.xmpp.event('chatstate_%s' % state, msg) diff --git a/sleekxmpp/plugins/xep_0199/ping.py b/sleekxmpp/plugins/xep_0199/ping.py index f8ae4018..a0f60532 100644 --- a/sleekxmpp/plugins/xep_0199/ping.py +++ b/sleekxmpp/plugins/xep_0199/ping.py @@ -118,7 +118,7 @@ class xep_0199(base_plugin): Arguments: iq -- The ping request. """ - log.debug("Pinged by %s" , iq['from']) + log.debug("Pinged by %s", iq['from']) iq.reply().send() def send_ping(self, jid, timeout=None, errorfalse=False, @@ -141,7 +141,7 @@ class xep_0199(base_plugin): is received. Useful in conjunction with the option block=False. """ - log.debug("Pinging %s" , jid) + log.debug("Pinging %s", jid) if timeout is None: timeout = self.timeout @@ -167,7 +167,7 @@ class xep_0199(base_plugin): if not block: return None - log.debug("Pong: %s %f" , jid, delay) + log.debug("Pong: %s %f", jid, delay) return delay diff --git a/sleekxmpp/plugins/xep_0224/attention.py b/sleekxmpp/plugins/xep_0224/attention.py index 4c03f6a5..4a3ff368 100644 --- a/sleekxmpp/plugins/xep_0224/attention.py +++ b/sleekxmpp/plugins/xep_0224/attention.py @@ -68,5 +68,5 @@ class xep_0224(base_plugin): Arguments: msg -- A message stanza with an attention element. """ - log.debug("Received attention request from: %s" , msg['from']) + log.debug("Received attention request from: %s", msg['from']) self.xmpp.event('attention', msg) -- cgit v1.2.3