Add __repr__ methods to interface types and Node, for nicer printing/logging

This commit is contained in:
Ian McEwen
2025-05-08 21:22:49 -07:00
parent 56680f8da6
commit 622a435465
4 changed files with 46 additions and 0 deletions

View File

@@ -42,6 +42,15 @@ class Node:
self.gotResponse = None
def __repr__(self):
r = f"Node({self.iface!r}, 0x{self.nodeNum:08x}"
if self.noProto:
r += ", noProto=True"
if self._timeout.expireTimeout != 300:
r += ", timeout={self._timeout.expireTimeout!r}"
r += ")"
return r
def showChannels(self):
"""Show human readable description of our channels."""
print("Channels:")