Mercurial > libervia-backend
diff src/memory/disco.py @ 993:301b342c697a
core: use of the new core.log module:
/!\ this is a massive refactoring and was largely automated, it probably did bring some bugs /!\
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 19 Apr 2014 19:19:19 +0200 |
parents | 4a8903021fda |
children | 7d640c303140 |
line wrap: on
line diff
--- a/src/memory/disco.py Sat Apr 19 16:48:26 2014 +0200 +++ b/src/memory/disco.py Sat Apr 19 19:19:19 2014 +0200 @@ -19,7 +19,8 @@ from sat.core.i18n import _ from sat.core import exceptions -from logging import debug, info, warning, error +from sat.core.log import getLogger +log = getLogger(__name__) from twisted.words.protocols.jabber import jid from twisted.words.protocols.jabber.error import StanzaError from twisted.internet import defer @@ -126,9 +127,9 @@ # we cache items only for our own server try: items = self.host.memory.getEntityData(jid_, ["DISCO_ITEMS"], client.profile)["DISCO_ITEMS"] - debug("[%s] disco items are in cache" % jid_.full()) + log.debug("[%s] disco items are in cache" % jid_.full()) except KeyError: - debug("Caching [%s] disco items" % jid_.full()) + log.debug("Caching [%s] disco items" % jid_.full()) items = yield client.disco.requestItems(jid_) self.host.memory.updateEntityData(jid_, "DISCO_ITEMS", items, client.profile) else: @@ -139,7 +140,7 @@ def _infosEb(self, failure, entity_jid): failure.trap(StanzaError) - warning(_("Error while requesting [%(jid)s]: %(error)s") % {'jid': entity_jid.full(), + log.warning(_("Error while requesting [%(jid)s]: %(error)s") % {'jid': entity_jid.full(), 'error': failure.getErrorMessage()}) def findServiceEntities(self, category, type_, jid_=None, profile_key=C.PROF_KEY_NONE): @@ -236,7 +237,7 @@ s.append('<') #TODO: manage XEP-0128 data form here cap_hash = b64encode(sha1(''.join(s)).digest()) - debug(_('Capability hash generated: [%s]') % cap_hash) + log.debug(_('Capability hash generated: [%s]') % cap_hash) return cap_hash @defer.inlineCallbacks