From d3124ac846eab26dc04701e15d273a7f81ad905f Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Tue, 30 Jul 2024 18:42:29 +0200 Subject: [PATCH] more logging --- printout.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/printout.py b/printout.py index b6c75bb..778a587 100644 --- a/printout.py +++ b/printout.py @@ -50,7 +50,7 @@ TABLE_LAYOUT = { }, } -# logging.basicConfig(level=logging.DEBUG) +logging.basicConfig(level=logging.DEBUG) LOG = logging.getLogger(__name__) mqtt_data = {} @@ -59,6 +59,7 @@ mqtt_data = {} def on_connect(client, userdata, flags, rc): LOG.info(f"Connected to mqtt server") mqtt.subscribe(MQTT_SUB) + LOG.info(f"subscribing to {MQTT_SUB}") def on_disconnect(client, userdata, rc): @@ -102,16 +103,20 @@ def generate_layout(): try: + LOG.info('mooooin!') mqtt = mqtt.Client() mqtt.on_connect = on_connect mqtt.on_disconnect = on_disconnect mqtt.on_message = on_message mqtt.connect(config["mqtt"]["host"], config["mqtt"]["port"], 10) - mqtt.loop_start() + LOG.info('starting loop') + mqtt.loop_start() with Live(generate_layout(), screen=True) as live: while True: live.update(generate_layout()) sleep(0.5) + mqtt.loop_stop() + LOG.info('bye') except Exception: LOG.exception("oops")