From fe06c1430387ea6341916678aa26b5cfe9f8304b Mon Sep 17 00:00:00 2001 From: souliane Date: Sat, 18 Oct 2014 16:28:37 +0200 Subject: [PATCH] core, plugins: improve a bit some log messages --- src/core/xmpp.py | 9 ++++++--- src/plugins/plugin_sec_otr.py | 2 +- src/plugins/plugin_xep_0054.py | 2 +- src/plugins/plugin_xep_0060.py | 4 ++-- src/plugins/plugin_xep_0115.py | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/core/xmpp.py b/src/core/xmpp.py index 2450a073..461b15d6 100644 --- a/src/core/xmpp.py +++ b/src/core/xmpp.py @@ -237,11 +237,14 @@ class SatRosterProtocol(xmppim.RosterClientProtocol): # may change in the future self.removeItem(item.jid) return - log.info(_("new contact in roster list: %s") % item.jid.full()) + log.debug(_("New contact in roster list: %s") % item.jid.full()) if not item.subscriptionTo: - log.warning(_("You are not subscribed to this contact !")) + if not item.subscriptionFrom: + log.info(_("There's no subscription between you and [%s]!") % item.jid.full()) + else: + log.info(_("You are not subscribed to [%s]!") % item.jid.full()) if not item.subscriptionFrom: - log.warning(_("This contact is not subscribed to you !")) + log.info(_("[%s] is not subscribed to you!") % item.jid.full()) #self.host.memory.addContact(item.jid, item_attr, item.groups, self.parent.profile) bare_jid = item.jid.userhostJID() diff --git a/src/plugins/plugin_sec_otr.py b/src/plugins/plugin_sec_otr.py index 2166c3e5..81bfc251 100644 --- a/src/plugins/plugin_sec_otr.py +++ b/src/plugins/plugin_sec_otr.py @@ -188,7 +188,7 @@ class ContextManager(object): def getContextForUser(self, other): log.debug(u"getContextForUser [%s]" % other) if not other.resource: - log.warning("getContextForUser called with a bare jid") + log.warning("getContextForUser called with a bare jid: %s" % other.full()) return self.startContext(other) diff --git a/src/plugins/plugin_xep_0054.py b/src/plugins/plugin_xep_0054.py index 36aebcf0..230832ea 100755 --- a/src/plugins/plugin_xep_0054.py +++ b/src/plugins/plugin_xep_0054.py @@ -143,7 +143,7 @@ class XEP_0054(object): """Parse a elem and save the picture""" for elem in photo_xml.elements(): if elem.name == 'TYPE': - log.info(_('Photo of type [%s] found') % str(elem)) + log.debug(_('Photo of type [%s] found') % str(elem)) if elem.name == 'BINVAL': log.debug(_('Decoding binary')) decoded = b64decode(str(elem)) diff --git a/src/plugins/plugin_xep_0060.py b/src/plugins/plugin_xep_0060.py index cc6a4483..8107738f 100755 --- a/src/plugins/plugin_xep_0060.py +++ b/src/plugins/plugin_xep_0060.py @@ -177,7 +177,7 @@ class XEP_0060(object): d_dict = {} for publisher, node in data.items(): if node not in found_nodes: - log.info("Skip the items retrieval for [{node}]: node doesn't exist".format(node=node)) + log.debug("Skip the items retrieval for [{node}]: node doesn't exist".format(node=node)) continue # avoid pubsub "item-not-found" error d_dict[publisher] = client.items(service, node, max_items, item_ids, sub_id, client.parent.jid) defer.returnValue(d_dict) @@ -223,7 +223,7 @@ class XEP_0060(object): d_list = [] for nodeIdentifier in (set(nodeIdentifiers) - set(subscribed_nodes)): if nodeIdentifier not in found_nodes: - log.info("Skip the subscription to [{node}]: node doesn't exist".format(node=nodeIdentifier)) + log.debug("Skip the subscription to [{node}]: node doesn't exist".format(node=nodeIdentifier)) continue # avoid sat-pubsub "SubscriptionExists" error d_list.append(client.subscribe(service, nodeIdentifier, sub_jid or client.parent.jid.userhostJID(), options=options)) defer.returnValue(d_list) diff --git a/src/plugins/plugin_xep_0115.py b/src/plugins/plugin_xep_0115.py index 451ca4e2..8b35e8c2 100755 --- a/src/plugins/plugin_xep_0115.py +++ b/src/plugins/plugin_xep_0115.py @@ -140,7 +140,7 @@ class XEP_0115_handler(XMPPHandler): c_hash = c_elem['hash'] c_node = c_elem['node'] except KeyError: - log.warning(_('Received invalid capabilities tag')) + log.warning(_('Received invalid capabilities tag: %s') % c_elem.toXml()) return if c_ver in self.host.memory.disco.hashes: