From ede5d4c1cec059e0329018b75f7fdb900c346c6d Mon Sep 17 00:00:00 2001 From: "Jarisch, Ferdinand" Date: Tue, 10 Oct 2023 10:38:20 +0200 Subject: [PATCH] chore(logs): Improve log messages in TesterPresent and DoIP --- src/gallia/services/uds/core/client.py | 9 ++++----- src/gallia/transports/doip.py | 6 ++++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/gallia/services/uds/core/client.py b/src/gallia/services/uds/core/client.py index 4f16b960b..2584f279a 100644 --- a/src/gallia/services/uds/core/client.py +++ b/src/gallia/services/uds/core/client.py @@ -113,7 +113,10 @@ async def request_unsafe( and resp.response_code == UDSErrorCodes.requestCorrectlyReceivedResponsePending ): - logger.info(f"Received ResponsePending: {n_pending}/{MAX_N_PENDING}") + logger.info( + f"Received ResponsePending: {n_pending}/{MAX_N_PENDING}; " + + f"waiting for next message: {n_timeout}/{int(max_n_timeout)}s" + ) try: raw_resp = await self._read(timeout=waiting_time, tags=config.tags) if raw_resp == b"": @@ -123,10 +126,6 @@ async def request_unsafe( # Send a tester present to indicate that # we are still there. await self._tester_present(suppress_resp=True) - logger.debug( - "Waiting for next message after ResponsePending: " - f"{n_timeout}/{max_n_timeout}" - ) n_timeout += 1 if n_timeout >= max_n_timeout: last_exception = MissingResponse(request, str(e)) diff --git a/src/gallia/transports/doip.py b/src/gallia/transports/doip.py index ed4e0d4f5..8953a9be7 100644 --- a/src/gallia/transports/doip.py +++ b/src/gallia/transports/doip.py @@ -409,7 +409,8 @@ async def read_diag_request_raw(self) -> DoIPDiagFrame: or payload.TargetAddress != self.src_addr ): logger.warning( - f"DoIP-DiagnosticMessage: unexpected addresses (src:dst); expected {self.src_addr}:{self.target_addr} but got: {payload.SourceAddress:#04x}:{payload.TargetAddress:#04x}" + f"DoIP-DiagnosticMessage: unexpected addresses (src:dst); expected {self.src_addr:#04x}:" + + f"{self.target_addr:#04x} but got: {payload.SourceAddress:#04x}:{payload.TargetAddress:#04x}" ) unexpected_packets.append((hdr, payload)) continue @@ -442,7 +443,8 @@ async def _read_ack(self, prev_data: bytes) -> None: or payload.TargetAddress != self.src_addr ): logger.warning( - f"DoIP-ACK: unexpected addresses (src:dst); expected {self.src_addr}:{self.target_addr} but got: {payload.SourceAddress:#04x}:{payload.TargetAddress:#04x}" + f"DoIP-ACK: unexpected addresses (src:dst); expected {self.src_addr:#04x}:{self.target_addr:#04x} " + + f"but got: {payload.SourceAddress:#04x}:{payload.TargetAddress:#04x}" ) unexpected_packets.append((hdr, payload)) continue