diff src/plugins/plugin_misc_text_syntaxes.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 75f3b3b430ff
children 7b4600ad73ad
line wrap: on
line diff
--- a/src/plugins/plugin_misc_text_syntaxes.py	Sat Apr 19 16:48:26 2014 +0200
+++ b/src/plugins/plugin_misc_text_syntaxes.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, error, warning
+from sat.core.log import getLogger
+log = getLogger(__name__)
 
 from wokkel import disco, pubsub
 from twisted.internet import defer
@@ -94,7 +95,7 @@
         }
 
     def __init__(self, host):
-        info(_("Text syntaxes plugin initialization"))
+        log.info(_("Text syntaxes plugin initialization"))
         self.host = host
         self.syntaxes = {}
         self.addSyntax(self.SYNTAX_XHTML, lambda xhtml: defer.succeed(xhtml), lambda xhtml: defer.succeed(xhtml),
@@ -109,7 +110,7 @@
                 return h.handle(html)
             self.addSyntax(self.SYNTAX_MARKDOWN, markdown.markdown, _html2text, [TextSyntaxes.OPT_DEFAULT])
         except ImportError:
-            warning("markdown or html2text not found, can't use Markdown syntax")
+            log.warning("markdown or html2text not found, can't use Markdown syntax")
         host.bridge.addMethod("syntaxConvert", ".plugin", in_sign='sssbs', out_sign='s',
                               async=True, method=self.convert)
 
@@ -173,7 +174,7 @@
             elif isinstance(xhtml, html.HtmlElement):
                 xhtml_elt = xhtml
             else:
-                error("Only strings and HtmlElements can be cleaned")
+                log.error("Only strings and HtmlElements can be cleaned")
                 raise exceptions.DataError
             cleaner = clean.Cleaner(style=False,
                                     add_nofollow=False,