diff src/plugins/plugin_misc_account.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 3a96920c07b7
children e90125d07072
line wrap: on
line diff
--- a/src/plugins/plugin_misc_account.py	Sat Apr 19 16:48:26 2014 +0200
+++ b/src/plugins/plugin_misc_account.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 sat.core import exceptions
 from twisted.internet import reactor, defer, protocol
 from os.path import join, dirname
@@ -88,10 +89,10 @@
 
     def processEnded(self, reason):
         if (reason.value.exitCode == 0):
-            info(_('Prosody command succeed'))
+            log.info(_('Prosody command succeed'))
             self.deferred.callback(None)
         else:
-            error(_(u"Can't complete Prosody command (error code: %(code)d): %(message)s") % {'code': reason.value.exitCode, 'message': self.data})
+            log.error(_(u"Can't complete Prosody command (error code: %(code)d): %(message)s") % {'code': reason.value.exitCode, 'message': self.data})
             self.deferred.errback(Failure(exceptions.InternalError))
 
     @classmethod
@@ -117,7 +118,7 @@
     #     only focused on Prosody) is planed
 
     def __init__(self, host):
-        info(_(u"Plugin Account initialization"))
+        log.info(_(u"Plugin Account initialization"))
         self.host = host
         host.bridge.addMethod("registerSatAccount", ".plugin", in_sign='sss', out_sign='', method=self._registerAccount, async=True)
         host.bridge.addMethod("getNewAccountDomain", ".plugin", in_sign='', out_sign='s', method=self.getNewAccountDomain, async=False)
@@ -126,10 +127,10 @@
         if self._prosody_path is None:
             paths = which(self.getConfig('prosodyctl'))
             if not paths:
-                error(_("Can't find %s") % (self.getConfig('prosodyctl'), ))
+                log.error(_("Can't find %s") % (self.getConfig('prosodyctl'), ))
             else:
                 self._prosody_path = dirname(paths[0])
-                info(_('Prosody path found: %s') % (self._prosody_path, ))
+                log.info(_('Prosody path found: %s') % (self._prosody_path, ))
 
         self.__account_cb_id = host.registerCallback(self._accountDialogCb, with_data=True)
         self.__delete_account_id = host.registerCallback(self.__deleteAccountCb, with_data=True)
@@ -193,7 +194,7 @@
 
         def email_ko(ignore):
             #TODO: return error code to user
-            error("Failed to send email to %s" % email)
+            log.error("Failed to send email to %s" % email)
 
         body = (u"""Welcome to Libervia, a Salut à Toi project part