Skip to content

Commit

Permalink
Add timestamps to communication logging
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdwetering committed Oct 13, 2024
1 parent e394b00 commit 43537d7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ynca/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ def handle_line(self, line):
value: str | None = None

logger.debug("Recv - %s", line)
self._communication_log_buffer.add(f"Received: {line}")
self._communication_log_buffer.add(
f"{time.perf_counter():.6f} Received: {line}"
)

if line == "@UNDEFINED":
status = YncaProtocolStatus.UNDEFINED
Expand Down Expand Up @@ -143,7 +145,7 @@ def _send_handler(self):

if not stop:
logger.debug("Send - %s", message)
self._communication_log_buffer.add(f"Send: {message}")
self._communication_log_buffer.add(f"{time.perf_counter():.6f} Send: {message}")

self._last_sent_command = message
self.write_line(message)
Expand Down

0 comments on commit 43537d7

Please sign in to comment.