kopia lustrzana https://github.com/Yakifo/amqtt
Merge pull request #184 from ajmirsky/rebase/106
Add exception stack traces to loggingpull/185/head
commit
d3635e4b2c
|
@ -152,11 +152,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")
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
||||
|
|
|
@ -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__":
|
||||
|
|
|
@ -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__":
|
||||
|
|
Ładowanie…
Reference in New Issue