From 116a33ba5162b2129dd787478f5ff2dd8f698b45 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Wed, 6 May 2015 13:03:47 +0200 Subject: Make syntax highlighting for XML lazy, to only call pygments when debug logs are enabled. Makes poezio about 11% faster when sending/receiving messages. --- slixmpp/xmlstream/xmlstream.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'slixmpp/xmlstream/xmlstream.py') diff --git a/slixmpp/xmlstream/xmlstream.py b/slixmpp/xmlstream/xmlstream.py index 0cd6720a..71873e48 100644 --- a/slixmpp/xmlstream/xmlstream.py +++ b/slixmpp/xmlstream/xmlstream.py @@ -354,7 +354,7 @@ class XMLStream(asyncio.BaseProtocol): log.debug('RECV: %s', highlight(tostring(self.xml_root, xmlns=self.default_ns, stream=self, top_level=True, - open_only=True)).strip()) + open_only=True))) self.start_stream_handler(self.xml_root) self.xml_depth += 1 if event == 'end': @@ -845,7 +845,7 @@ class XMLStream(asyncio.BaseProtocol): :param string data: Any bytes or utf-8 string value. """ - log.debug("SEND: %s", highlight(data).strip()) + log.debug("SEND: %s", highlight(data)) if not self.transport: raise NotConnectedError() if isinstance(data, str): @@ -898,7 +898,7 @@ class XMLStream(asyncio.BaseProtocol): if stanza is None: return - log.debug("RECV: %s", highlight(str(stanza)).strip()) + log.debug("RECV: %s", highlight(stanza)) # Match the stanza against registered handlers. Handlers marked # to run "in stream" will be executed immediately; the rest will -- cgit v1.2.3