reapplying any remaining stack traces to logging messages that weren't already included in other updates

pull/184/head
Andrew Mirsky 2025-05-26 11:27:42 -04:00
rodzic b982e4242a
commit b43583c954
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: A98E67635CDF2C39
8 zmienionych plików z 17 dodań i 17 usunięć

Wyświetl plik

@ -138,11 +138,11 @@ class ProtocolHandler:
if self.writer is not None:
await self.writer.close()
except asyncio.CancelledError:
self.logger.debug("Writer close was cancelled.")
except TimeoutError as e:
self.logger.debug(f"Writer close operation timed out: {e}.")
except OSError as e:
self.logger.debug(f"Writer close failed due to I/O error: {e}")
self.logger.debug("Writer close was cancelled.", exc_info=True)
except TimeoutError:
self.logger.debug("Writer close operation timed out.", exc_info=True)
except OSError:
self.logger.debug("Writer close failed due to I/O error.", exc_info=True)
def _stop_waiters(self) -> None:
self.logger.debug(f"Stopping {len(self._puback_waiters)} puback waiters")

Wyświetl plik

@ -86,8 +86,8 @@ class PluginManager:
plugin_context.logger = self.logger.getChild(ep.name)
obj = plugin(plugin_context)
return Plugin(ep.name, ep, obj)
except ImportError as ie:
self.logger.warning(f"Plugin {ep!r} import failed: {ie}")
except ImportError:
self.logger.warning(f"Plugin {ep!r} import failed", exc_info=True)
return None

Wyświetl plik

@ -106,8 +106,8 @@ async def do_sub(client: MQTTClient, arguments: dict[str, Any]) -> None:
except KeyboardInterrupt:
await client.disconnect()
logger.info(f"{client.client_id} Disconnected from broker")
except ConnectError as ce:
logger.fatal(f"Connection to '{arguments['--url']}' failed: {ce!r}")
except ConnectError:
logger.fatal(f"Connection to '{arguments['--url']}' failed.", exc_info=True)
except asyncio.CancelledError:
logger.fatal("Publish canceled due to previous error")

Wyświetl plik

@ -38,8 +38,8 @@ The example below shows how to write a simple MQTT client which subscribes a top
print("%d: %s => %s" % (i, packet.variable_header.topic_name, str(packet.payload.data)))
await C.unsubscribe(['$SYS/broker/uptime', '$SYS/broker/load/#'])
await C.disconnect()
except ClientException as ce:
logger.error("Client exception: %s" % ce)
except ClientException:
logger.error("Client exception", exc_info=True)
if __name__ == '__main__':
formatter = "[%(asctime)s] %(name)s {%(filename)s:%(lineno)d} %(levelname)s - %(message)s"

Wyświetl plik

@ -43,8 +43,8 @@ async def test_coro2() -> None:
await C.publish("a/b", b"TEST MESSAGE WITH QOS_2", qos=0x02)
logger.info("messages published")
await C.disconnect()
except ConnectError as ce:
logger.exception(f"Connection failed: {ce}")
except ConnectError:
logger.exception(f"Connection failed", exc_info=True)
asyncio.get_event_loop().stop()

Wyświetl plik

@ -27,7 +27,7 @@ async def test_coro() -> None:
logger.info("messages published")
await C.disconnect()
except ConnectError as ce:
logger.exception(f"Connection failed: {ce}")
logger.exception("Connection failed")
asyncio.get_event_loop().stop()

Wyświetl plik

@ -30,8 +30,8 @@ async def uptime_coro() -> None:
await C.unsubscribe(["$SYS/broker/uptime", "$SYS/broker/load/#"])
logger.info("UnSubscribed")
await C.disconnect()
except ClientError as ce:
logger.exception(f"Client exception: {ce}")
except ClientError:
logger.exception("Client exception")
if __name__ == "__main__":

Wyświetl plik

@ -35,7 +35,7 @@ async def uptime_coro() -> None:
logger.info("UnSubscribed")
await C.disconnect()
except ClientError as ce:
logger.exception(f"Client exception: {ce}")
logger.exception("Client exception")
if __name__ == "__main__":