summaryrefslogtreecommitdiff
path: root/distbuild/initiator_connection.py
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2014-04-09 14:02:04 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2014-04-10 15:13:29 +0300
commitb772a26680895ecf102b524444623fc10c4d183d (patch)
tree7c857d2dfddba58118e2e399d896205e740edc6e /distbuild/initiator_connection.py
parentfb92c950ebd8fd8129fc40203be2b9210c15d3db (diff)
downloadmorph-b772a26680895ecf102b524444623fc10c4d183d.tar.gz
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).
Diffstat (limited to 'distbuild/initiator_connection.py')
-rw-r--r--distbuild/initiator_connection.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/distbuild/initiator_connection.py b/distbuild/initiator_connection.py
index 48d083e4..e6202908 100644
--- a/distbuild/initiator_connection.py
+++ b/distbuild/initiator_connection.py
@@ -52,6 +52,10 @@ class InitiatorConnection(distbuild.StateMachine):
self.artifact_cache_server = artifact_cache_server
self.morph_instance = morph_instance
+ def __repr__(self):
+ remote = self.conn.remotename()
+ return '<InitiatorConnection at 0x%x: remote %s>' % (id(self), remote)
+
def setup(self):
self.jm = distbuild.JsonMachine(self.conn)
self.mainloop.add_state_machine(self.jm)