diff src/plugins/plugin_tmp_demo_directory.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 0d1a17375bf5
children 9c17bd37e6e5
line wrap: on
line diff
--- a/src/plugins/plugin_tmp_demo_directory.py	Sat Apr 19 16:48:26 2014 +0200
+++ b/src/plugins/plugin_tmp_demo_directory.py	Sat Apr 19 19:19:19 2014 +0200
@@ -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 @@
     }
 
     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 @@
         """
         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 @@
             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()