mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-27 11:09:56 +00:00
Tidy up logging calls.
This commit is contained in:
parent
deb52ad350
commit
429c94d6a9
23 changed files with 80 additions and 81 deletions
|
@ -282,7 +282,7 @@ class BaseXMPP(XMLStream):
|
|||
if key in self.plugin:
|
||||
return self.plugin[key]
|
||||
else:
|
||||
log.warning("""Plugin "%s" is not loaded.""" , key)
|
||||
log.warning("Plugin '%s' is not loaded.", key)
|
||||
return False
|
||||
|
||||
def get(self, key, default):
|
||||
|
@ -790,8 +790,8 @@ class BaseXMPP(XMLStream):
|
|||
"""
|
||||
if isinstance(exception, IqError):
|
||||
iq = exception.iq
|
||||
log.error('%s: %s' % (iq['error']['condition'],
|
||||
iq['error']['text']))
|
||||
log.error('%s: %s', iq['error']['condition'],
|
||||
iq['error']['text'])
|
||||
log.warning('You should catch IqError exceptions')
|
||||
elif isinstance(exception, IqTimeout):
|
||||
iq = exception.iq
|
||||
|
|
|
@ -168,7 +168,7 @@ class ClientXMPP(BaseXMPP):
|
|||
answers = super(ClientXMPP, self).get_dns_records(domain, port)
|
||||
except dns.exception.Timeout:
|
||||
log.warning("DNS resolution timed out " + \
|
||||
"for SRV record of %s" % domain)
|
||||
"for SRV record of %s", domain)
|
||||
answers = super(ClientXMPP, self).get_dns_records(domain, port)
|
||||
return answers
|
||||
else:
|
||||
|
|
|
@ -87,8 +87,8 @@ class ComponentXMPP(BaseXMPP):
|
|||
|
||||
Overrides XMLStream.connect.
|
||||
"""
|
||||
log.debug("Connecting to %s:%s" % (self.server_host,
|
||||
self.server_port))
|
||||
log.debug("Connecting to %s:%s", self.server_host,
|
||||
self.server_port)
|
||||
return XMLStream.connect(self, self.server_host,
|
||||
self.server_port)
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -1261,8 +1261,8 @@ class StanzaBase(ElementBase):
|
|||
|
||||
Meant to be overridden.
|
||||
"""
|
||||
log.exception('Error handling {%s}%s stanza' % (self.namespace,
|
||||
self.name))
|
||||
log.exception('Error handling {%s}%s stanza', self.namespace,
|
||||
self.name)
|
||||
|
||||
def send(self, now=False):
|
||||
"""
|
||||
|
|
|
@ -402,8 +402,8 @@ class XMLStream(object):
|
|||
except Socket.error as serr:
|
||||
error_msg = "Could not connect to %s:%s. Socket Error #%s: %s"
|
||||
self.event('socket_error', serr)
|
||||
log.error(error_msg % (self.address[0], self.address[1],
|
||||
serr.errno, serr.strerror))
|
||||
log.error(error_msg, self.address[0], self.address[1],
|
||||
serr.errno, serr.strerror)
|
||||
self.reconnect_delay = delay
|
||||
return False
|
||||
|
||||
|
@ -455,8 +455,8 @@ class XMLStream(object):
|
|||
except Socket.error as serr:
|
||||
error_msg = "Could not connect to %s:%s. Socket Error #%s: %s"
|
||||
self.event('socket_error', serr)
|
||||
log.error(error_msg % (self.address[0], self.address[1],
|
||||
serr.errno, serr.strerror))
|
||||
log.error(error_msg, self.address[0], self.address[1],
|
||||
serr.errno, serr.strerror)
|
||||
return False
|
||||
|
||||
def _handle_connected(self, event=None):
|
||||
|
@ -468,7 +468,7 @@ class XMLStream(object):
|
|||
def _handle_session_timeout():
|
||||
if not self.session_started_event.isSet():
|
||||
log.debug("Session start has taken more " + \
|
||||
"than %d seconds" % self.session_timeout)
|
||||
"than %d seconds", self.session_timeout)
|
||||
self.disconnect(reconnect=self.auto_reconnect)
|
||||
|
||||
self.schedule("Session timeout check",
|
||||
|
@ -763,7 +763,7 @@ class XMLStream(object):
|
|||
return [((domain, port), 0, 0)]
|
||||
except dns.exception.Timeout:
|
||||
log.warning("DNS resolution timed out " + \
|
||||
"for A record of %s" % domain)
|
||||
"for A record of %s", domain)
|
||||
return [((domain, port), 0, 0)]
|
||||
else:
|
||||
return [((ans.address, port), 0, 0) for ans in answers]
|
||||
|
@ -1187,8 +1187,7 @@ class XMLStream(object):
|
|||
Arguments:
|
||||
xml -- The XML stanza to analyze.
|
||||
"""
|
||||
log.debug("RECV: %s" , tostring(xml,
|
||||
xmlns=self.default_ns,
|
||||
log.debug("RECV: %s", tostring(xml, xmlns=self.default_ns,
|
||||
stream=self))
|
||||
# Apply any preprocessing filters.
|
||||
xml = self.incoming_filter(xml)
|
||||
|
|
Loading…
Reference in a new issue