Mercurial > libervia-backend
diff src/plugins/plugin_misc_text_commands.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 | 059b56cbd247 |
children | 291eb8216f6e |
line wrap: on
line diff
--- a/src/plugins/plugin_misc_text_commands.py Sat Apr 19 16:48:26 2014 +0200 +++ b/src/plugins/plugin_misc_text_commands.py Sat Apr 19 19:19:19 2014 +0200 @@ -23,7 +23,8 @@ from twisted.words.protocols.jabber import jid from twisted.internet import defer from twisted.python.failure import Failure -from logging import debug, info, warning, error +from sat.core.log import getLogger +log = getLogger(__name__) PLUGIN_INFO = { "name": "Text commands", @@ -43,7 +44,7 @@ # should be downloadable independently) def __init__(self, host): - info(_("Text commands initialization")) + log.info(_("Text commands initialization")) self.host = host host.trigger.add("sendMessage", self.sendMessageTrigger) self._commands = {} @@ -59,20 +60,20 @@ if attr.startswith('cmd_'): cmd = getattr(instance, attr) if not callable(cmd): - warning(_("Skipping not callable [%s] attribute") % attr) + log.warning(_("Skipping not callable [%s] attribute") % attr) continue cmd_name = attr[4:] if not cmd_name: - warning(_("Skipping cmd_ method")) + log.warning(_("Skipping cmd_ method")) if cmd_name in self._commands: suff=2 while (cmd_name + str(suff)) in self._commands: suff+=1 new_name = cmd_name + str(suff) - warning(_("Conflict for command [%(old_name)s], renaming it to [%(new_name)s]") % {'old_name': cmd_name, 'new_name': new_name}) + log.warning(_("Conflict for command [%(old_name)s], renaming it to [%(new_name)s]") % {'old_name': cmd_name, 'new_name': new_name}) cmd_name = new_name self._commands[cmd_name] = cmd - info(_("Registered text command [%s]") % cmd_name) + log.info(_("Registered text command [%s]") % cmd_name) def addWhoIsCb(self, callback, priority=0): """Add a callback which give information to the /whois command @@ -160,7 +161,7 @@ def cmd_whois(self, mess_data, profile): """show informations on entity""" - debug("Catched whois command") + log.debug("Catched whois command") entity = mess_data["unparsed"].strip() @@ -170,7 +171,7 @@ if self.host.plugins["XEP-0045"].isNickInRoom(room, entity, profile): entity = u"%s/%s" % (room, entity) except KeyError: - warning("plugin XEP-0045 is not present") + log.warning("plugin XEP-0045 is not present") if not entity: target_jid = mess_data["to"]