From b772a26680895ecf102b524444623fc10c4d183d Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Wed, 9 Apr 2014 14:02:04 +0000 Subject: distbuild: Improve logging of connections and objects New DistbuildSocket class that wraps socket.socket(), providing a descriptive repr() handler showing where the socket is connected, and providing a couple of helper methods for fetching local and remote endpoint names. This commit also adds a descriptive repr() handler to a few other objects (mostly giving socket connection details). --- distbuild/sockbuf.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'distbuild/sockbuf.py') diff --git a/distbuild/sockbuf.py b/distbuild/sockbuf.py index a7fe339a..6803bfb5 100644 --- a/distbuild/sockbuf.py +++ b/distbuild/sockbuf.py @@ -77,6 +77,10 @@ class SocketBuffer(StateMachine): self._sock = sock self._max_buffer = max_buffer + def __repr__(self): + return '' % ( + id(self), self._sock, self._max_buffer) + def setup(self): src = self._src = SocketEventSource(self._sock) src.stop_writing() # We'll start writing when we need to. -- cgit v1.2.1