Improve logging

main
Valentin Ochs 2023-05-02 00:15:47 +02:00
parent 7185e32734
commit c7ee716dbe
1 changed files with 3 additions and 0 deletions

View File

@ -76,6 +76,9 @@ def reconnecting_client(host: str, *, keepalive: int = 60):
client = Client()
client.on_connect = lambda client, userdata, flags, rc: \
_logger.debug("Connected to mqtt host")
client.on_disconnect = lambda client, userdata, rc: \
_logger.debug("Disconnected from mqtt host")
client.enable_logger(_logger.getChild("paho"))
client.connect_async(host, keepalive=keepalive)
client.loop_start()
return client