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.constants import Const as C
|
||||
from logging import debug, info, warning, error
|
||||
from sat.core.log import getLogger
|
||||
log = getLogger(__name__)
|
||||
from twisted.words.protocols.jabber import jid
|
||||
|
||||
from sat.core.exceptions import UnknownEntityError
|
||||
|
|
@ -46,14 +47,14 @@ class Exp_Parrot(object):
|
|||
# /unparrot command in text commands plugin.
|
||||
|
||||
def __init__(self, host):
|
||||
info(_("Plugin Parrot initialization"))
|
||||
log.info(_("Plugin Parrot initialization"))
|
||||
self.host = host
|
||||
host.trigger.add("MessageReceived", self.MessageReceivedTrigger, priority=100)
|
||||
#host.trigger.add("sendMessage", self.sendMessageTrigger, priority=100)
|
||||
try:
|
||||
self.host.plugins[C.TEXT_CMDS].registerTextCommands(self)
|
||||
except KeyError:
|
||||
info(_("Text commands not available"))
|
||||
log.info(_("Text commands not available"))
|
||||
|
||||
#def sendMessageTrigger(self, mess_data, treatments, profile):
|
||||
# """ Deactivate other triggers if recipient is in parrot links """
|
||||
|
|
@ -64,7 +65,7 @@ class Exp_Parrot(object):
|
|||
# return True
|
||||
#
|
||||
# if mess_data['to'].userhostJID() in _links.values():
|
||||
# debug("Parrot link detected, skipping other triggers")
|
||||
# log.debug("Parrot link detected, skipping other triggers")
|
||||
# raise SkipOtherTriggers
|
||||
|
||||
def MessageReceivedTrigger(self, message, post_treat, profile):
|
||||
|
|
@ -101,7 +102,7 @@ class Exp_Parrot(object):
|
|||
|
||||
self.host.sendMessage(jid.JID(unicode(linked)), msg, None, "auto", no_trigger=True, profile_key=profile)
|
||||
else:
|
||||
warning("No body element found in message, following normal behaviour")
|
||||
log.warning("No body element found in message, following normal behaviour")
|
||||
|
||||
return True
|
||||
|
||||
|
|
@ -117,7 +118,7 @@ class Exp_Parrot(object):
|
|||
_links = client.parrot_links = {}
|
||||
|
||||
_links[source_jid.userhostJID()] = dest_jid
|
||||
info("Parrot mode: %s will be repeated to %s" % (source_jid.userhost(), unicode(dest_jid)))
|
||||
log.info("Parrot mode: %s will be repeated to %s" % (source_jid.userhost(), unicode(dest_jid)))
|
||||
|
||||
def removeParrot(self, source_jid, profile):
|
||||
"""Remove parrot link
|
||||
|
|
@ -131,7 +132,7 @@ class Exp_Parrot(object):
|
|||
|
||||
def cmd_parrot(self, mess_data, profile):
|
||||
"""activate Parrot mode between 2 entities, in both directions."""
|
||||
debug("Catched parrot command")
|
||||
log.debug("Catched parrot command")
|
||||
txt_cmd = self.host.plugins[C.TEXT_CMDS]
|
||||
|
||||
try:
|
||||
|
|
@ -153,7 +154,7 @@ class Exp_Parrot(object):
|
|||
|
||||
def cmd_unparrot(self, mess_data, profile):
|
||||
"""remove Parrot mode between 2 entities, in both directions."""
|
||||
debug("Catched unparrot command")
|
||||
log.debug("Catched unparrot command")
|
||||
txt_cmd = self.host.plugins[C.TEXT_CMDS]
|
||||
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in a new issue