diff options
author | Alex Bennée <alex.bennee@linaro.org> | 2020-12-10 19:04:14 +0000 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2021-01-02 21:03:09 +0100 |
commit | afded359a6c413d5dab68b1b1c692d8efc196eaa (patch) | |
tree | 15a4b7dfca956ffe0ea50e199352d0f4f7ae3c74 /python | |
parent | c87ea11631119175a581b17900ea62e127638352 (diff) |
python: add __repr__ to ConsoleSocket to aid debugging
While attempting to debug some console weirdness I thought it would be
worth making it easier to see what it had inside.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Message-Id: <20201210190417.31673-6-alex.bennee@linaro.org>
Diffstat (limited to 'python')
-rw-r--r-- | python/qemu/console_socket.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/python/qemu/console_socket.py b/python/qemu/console_socket.py index f060d79e06..ac21130e44 100644 --- a/python/qemu/console_socket.py +++ b/python/qemu/console_socket.py @@ -45,6 +45,13 @@ class ConsoleSocket(socket.socket): if drain: self._drain_thread = self._thread_start() + def __repr__(self) -> str: + s = super().__repr__() + s = s.rstrip(">") + s = "%s, logfile=%s, drain_thread=%s>" % (s, self._logfile, + self._drain_thread) + return s + def _drain_fn(self) -> None: """Drains the socket and runs while the socket is open.""" while self._open: |