Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add log.debug() statements to readstream. To see traffic: xmpp.log.se…

…tLevel(logging.DEBUG)
  • Loading branch information...
commit c22d8b4b9c9440fb5dbc1a3609ba743f2b2c7c03 1 parent 3259f59
@weaver weaver authored
Showing with 6 additions and 2 deletions.
  1. +1 −0  xmpp/__init__.py
  2. +5 −2 xmpp/readstream.py
View
1  xmpp/__init__.py
@@ -1,5 +1,6 @@
from __future__ import absolute_import
from .interfaces import *
+from .prelude import log
from .aio import *
from .xml import jid, bare, is_full_jid, is_bare_jid
from .readstream import *
View
7 xmpp/readstream.py
@@ -1,4 +1,4 @@
-## Copyright (c) 2010, Coptix, Inc. All rights reserved.
+# Copyright (c) 2010, Coptix, Inc. All rights reserved.
## See the LICENSE file for license terms and warranty disclaimer.
"""readstream -- non-blocking unbuffered reads / buffered writes"""
@@ -65,6 +65,7 @@ def close(self):
"""Immediately close the stream."""
if self.socket:
+ if __debug__: log.debug('CLOSE')
self.io.remove_handler(self.socket.fileno())
self.socket.close()
self.socket = None
@@ -137,6 +138,8 @@ def _read(self):
self.close()
return
+ if __debug__: log.debug('READ: %r', chunk)
+
if not chunk:
self.close()
return
@@ -147,7 +150,7 @@ def _write(self):
while self._wb:
try:
sent = self.socket.send(self._wb)
- ## print 'wrote!', self._wb[:sent]
+ if __debug__: log.debug('WROTE: %r', self._wb[:sent])
self._wb = self._wb[sent:]
except aio.SocketError as exc:
if aio.would_block(exc):
Please sign in to comment.
Something went wrong with that request. Please try again.