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
|
|
@ -18,7 +18,8 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from sat.core.i18n import _, D_
|
||||
from logging import debug, info, warning, error
|
||||
from sat.core.log import getLogger
|
||||
log = getLogger(__name__)
|
||||
from twisted.internet import defer
|
||||
from twisted.words.protocols.jabber.xmlstream import IQ
|
||||
from twisted.words.protocols.jabber import jid
|
||||
|
|
@ -74,10 +75,10 @@ class DemoDirectory(object):
|
|||
}
|
||||
|
||||
def __init__(self, host):
|
||||
info(_(u"Plugin demo directory initialization"))
|
||||
log.info(_(u"Plugin demo directory initialization"))
|
||||
activate = host.memory.getConfig(CONFIG_SECTION, CONFIG_ACTIVATE) or 'false'
|
||||
if not activate.lower() in ('true', 'yes', '1'):
|
||||
info("not activated")
|
||||
log.info("not activated")
|
||||
return
|
||||
service_str = host.memory.getConfig(CONFIG_SECTION, CONFIG_SERVICE) or 'salut.libervia.org'
|
||||
self.service = jid.JID(service_str)
|
||||
|
|
@ -95,7 +96,7 @@ class DemoDirectory(object):
|
|||
"""
|
||||
client = self.host.getClient(profile)
|
||||
if not subscribe:
|
||||
info ("Unsubscribing [%s] from directory" % profile)
|
||||
log.info ("Unsubscribing [%s] from directory" % profile)
|
||||
unsub_req = IQ(client.xmlstream, 'set')
|
||||
unsub_req['from'] = client.jid.full()
|
||||
unsub_req['to'] = self.service.userhost()
|
||||
|
|
@ -104,7 +105,7 @@ class DemoDirectory(object):
|
|||
command_elt['action'] = 'execute'
|
||||
yield unsub_req.send(self.service.userhost())
|
||||
else:
|
||||
info ("Subscribing [%s] to directory" % profile)
|
||||
log.info ("Subscribing [%s] to directory" % profile)
|
||||
sub_req = IQ(client.xmlstream, 'set')
|
||||
sub_req['from'] = client.jid.full()
|
||||
sub_req['to'] = self.service.userhost()
|
||||
|
|
|
|||
Loading…
Reference in a new issue