From d9d0dcdbaf947e45e7137212585fe4b493158ac2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torma=20Krist=C3=B3f?= Date: Fri, 18 Sep 2020 14:45:58 +0200 Subject: [PATCH] logging basicconig marcsello edition --- src/app.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app.py b/src/app.py index 83963ef..1b0c223 100644 --- a/src/app.py +++ b/src/app.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +import sys import json import logging @@ -69,7 +70,8 @@ def on_message(channel, method_frame, header_frame, body): if __name__ == "__main__": - logging.basicConfig(level="DEBUG") + logging.basicConfig(stream=sys.stdout, format="%(asctime)s - %(name)s [%(levelname)s]: %(message)s", + level=logging.DEBUG if '--debug' in sys.argv else logging.INFO) logging.info("Guard service starting") mqtt = MQTT() mqtt.topic = config.MQTT_TOPIC