core: use of the new core.log module:
/!\ this is a massive refactoring and was largely automated, it probably did bring some bugs /!\
This commit is contained in:
parent
dc5c042fe7
commit
501bc92528
1 changed files with 707 additions and 941 deletions
|
|
@ -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 @@ class Discovery(object):
|
|||
# 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 @@ class Discovery(object):
|
|||
|
||||
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 @@ class Discovery(object):
|
|||
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue