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 _
from logging import debug, info, error
from sat.core.log import getLogger
log = getLogger(__name__)
from twisted.words.protocols.jabber.xmlstream import XmlStream
from twisted.words.xish import domish
@ -43,7 +44,7 @@ class LoggingXmlStream(XmlStream):
elif isinstance(obj, domish.Element):
log = obj.toXml()
else:
error(_('INTERNAL ERROR: Unmanaged XML type'))
log.error(_('INTERNAL ERROR: Unmanaged XML type'))
self._host.bridge.xmlLog("OUT", log, self._profile)
return XmlStream.send(self, obj)
@ -65,7 +66,7 @@ class XmlLog(object):
""" % {"label_xmllog": _("Activate XML log")}
def __init__(self, host):
info(_("Plugin XML Log initialization"))
log.info(_("Plugin XML Log initialization"))
self.host = host
#parameters
@ -76,7 +77,7 @@ class XmlLog(object):
do_log = self.host.memory.getParamA("Xml log", "Debug")
if do_log:
info(_("XML log activated"))
log.info(_("XML log activated"))
host.trigger.add("XML Initialized", self.logXml)
def logXml(self, xmlstream, profile):