xmlstream: Remove pygments dumping.

It’s slow and makes the debug logs difficult to parse.
This commit is contained in:
Emmanuel Gil Peyrot 2017-07-17 21:17:02 +01:00
parent 4dfdd5d8e3
commit 2d2a80c73d

View File

@ -22,7 +22,7 @@ import uuid
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
from slixmpp.xmlstream.asyncio import asyncio from slixmpp.xmlstream.asyncio import asyncio
from slixmpp.xmlstream import tostring, highlight from slixmpp.xmlstream import tostring
from slixmpp.xmlstream.stanzabase import StanzaBase, ElementBase from slixmpp.xmlstream.stanzabase import StanzaBase, ElementBase
from slixmpp.xmlstream.resolver import resolve, default_resolver from slixmpp.xmlstream.resolver import resolve, default_resolver
@ -375,12 +375,11 @@ class XMLStream(asyncio.BaseProtocol):
if self.xml_depth == 0: if self.xml_depth == 0:
# We have received the start of the root element. # We have received the start of the root element.
self.xml_root = xml self.xml_root = xml
log.debug('RECV: %s', log.debug('RECV: %s', tostring(self.xml_root,
highlight(tostring(self.xml_root, xmlns=self.default_ns,
xmlns=self.default_ns, stream=self,
stream=self, top_level=True,
top_level=True, open_only=True))
open_only=True)))
self.start_stream_handler(self.xml_root) self.start_stream_handler(self.xml_root)
self.xml_depth += 1 self.xml_depth += 1
if event == 'end': if event == 'end':
@ -875,8 +874,7 @@ class XMLStream(asyncio.BaseProtocol):
if data is None: if data is None:
return return
str_data = tostring(data.xml, xmlns=self.default_ns, str_data = tostring(data.xml, xmlns=self.default_ns,
stream=self, stream=self, top_level=True)
top_level=True)
self.send_raw(str_data) self.send_raw(str_data)
else: else:
self.send_raw(data) self.send_raw(data)
@ -894,7 +892,7 @@ class XMLStream(asyncio.BaseProtocol):
:param string data: Any bytes or utf-8 string value. :param string data: Any bytes or utf-8 string value.
""" """
log.debug("SEND: %s", highlight(data)) log.debug("SEND: %s", data)
if not self.transport: if not self.transport:
raise NotConnectedError() raise NotConnectedError()
if isinstance(data, str): if isinstance(data, str):
@ -947,7 +945,7 @@ class XMLStream(asyncio.BaseProtocol):
if stanza is None: if stanza is None:
return return
log.debug("RECV: %s", highlight(stanza)) log.debug("RECV: %s", stanza)
# Match the stanza against registered handlers. Handlers marked # Match the stanza against registered handlers. Handlers marked
# to run "in stream" will be executed immediately; the rest will # to run "in stream" will be executed immediately; the rest will