Mercurial > libervia-backend
diff src/plugins/plugin_exp_parrot.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 | cd150dd947e3 |
children | bf3f669a6052 |
line wrap: on
line diff
--- a/src/plugins/plugin_exp_parrot.py Sat Apr 19 16:48:26 2014 +0200 +++ b/src/plugins/plugin_exp_parrot.py Sat Apr 19 19:19:19 2014 +0200 @@ -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 @@ # /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 @@ # 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 @@ 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 @@ _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 @@ 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 @@ 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: