Mercurial > libervia-backend
diff sat/plugins/plugin_misc_xmllog.py @ 2624:56f94936df1e
code style reformatting using black
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 27 Jun 2018 20:14:46 +0200 |
parents | 26edcf3a30eb |
children | 1ecceac3df96 |
line wrap: on
line diff
--- a/sat/plugins/plugin_misc_xmllog.py Wed Jun 27 07:51:29 2018 +0200 +++ b/sat/plugins/plugin_misc_xmllog.py Wed Jun 27 20:14:46 2018 +0200 @@ -20,6 +20,7 @@ from sat.core.i18n import _ from sat.core.constants import Const as C from sat.core.log import getLogger + log = getLogger(__name__) from twisted.words.xish import domish from twisted.words.xish import xmlstream @@ -32,11 +33,12 @@ C.PI_DEPENDENCIES: [], C.PI_MAIN: "XmlLog", C.PI_HANDLER: "no", - C.PI_DESCRIPTION: _(u"""Send raw XML logs to bridge""") + C.PI_DESCRIPTION: _(u"""Send raw XML logs to bridge"""), } host = None + def send(self, obj): global host if isinstance(obj, basestring): @@ -44,7 +46,7 @@ elif isinstance(obj, domish.Element): log = obj.toXml() else: - log.error(_(u'INTERNAL ERROR: Unmanaged XML type')) + log.error(_(u"INTERNAL ERROR: Unmanaged XML type")) host.bridge.xmlLog("OUT", log, self._profile) return self._original_send(obj) @@ -65,18 +67,22 @@ </category> </general> </params> - """ % {"label_xmllog": _("Activate XML log")} + """ % { + "label_xmllog": _("Activate XML log") + } def __init__(self, host_): log.info(_("Plugin XML Log initialization")) global host host = host_ - #parameters + # parameters host.memory.updateParams(self.params) - #bridge - host.bridge.addSignal("xmlLog", ".plugin", signature='sss') # args: direction("IN" or "OUT"), xml_data, profile + # bridge + host.bridge.addSignal( + "xmlLog", ".plugin", signature="sss" + ) # args: direction("IN" or "OUT"), xml_data, profile self.do_log = host.memory.getParamA("Xml log", "Debug") if self.do_log: @@ -85,7 +91,7 @@ XmlStream._original_onElement = XmlStream.onElement XmlStream.send = send XmlStream.onElement = onElement - XmlStream._profile = '' + XmlStream._profile = "" host.trigger.add("XML Initialized", self.setProfile) log.info(_(u"XML log activated"))