Logging via MQTT
With this in place we can use the default python logging interface to log messages via MQTT, just like we know it :
logging.warning("there's something strange in your neighborhood.")
logging.debug("Who you gonna call?")
and will result in mqtt payload like this on the logging/{THING_ID}
topic:
{"timestamp": 1658846661.9593406, "level": "WARNING", "message": "there's something strange in your neighborhood.", "extra": {"filename": "scratch_43.py", "pid": 239726}}
{"timestamp": 1658846661.9595904, "level": "DEBUG", "message": "Who you gonna call?", "extra": {"filename": "scratch_43.py", "pid": 239726}}
We might put the Handler in an own repository ?
Edited by Luca Johannes Nendel