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:
Goffi 2014-04-19 19:19:19 +02:00
commit 501bc92528

View file

@ -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 @@ class ProsodyRegisterProtocol(protocol.ProcessProtocol):
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 @@ class MiscAccount(object):
# 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 @@ class MiscAccount(object):
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 @@ class MiscAccount(object):
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