From 1ffd5a72d78b1567c50caf70df28fa3f54e21977 Mon Sep 17 00:00:00 2001 From: Pim van den Berg Date: Wed, 19 Jul 2023 13:34:21 +0200 Subject: [PATCH] fix(itho_i2c): make loglevel in itho_i2c module adjustable --- itho-wpu.py | 1 + itho_i2c.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/itho-wpu.py b/itho-wpu.py index 199472f..431353d 100755 --- a/itho-wpu.py +++ b/itho-wpu.py @@ -434,6 +434,7 @@ def main(): if args.loglevel: logger.setLevel(args.loglevel.upper()) + logging.getLogger("itho_i2c").setLevel(args.loglevel.upper()) if args.timestamp: stdout_log_handler.setFormatter( diff --git a/itho_i2c.py b/itho_i2c.py index 64e8f4f..ca4b660 100644 --- a/itho_i2c.py +++ b/itho_i2c.py @@ -4,8 +4,13 @@ import logging import pigpio import struct import time +import sys logger = logging.getLogger(__name__) +logger.setLevel(logging.INFO) +stdout_log_handler = logging.StreamHandler(sys.stdout) +stdout_log_handler.setFormatter(logging.Formatter("%(message)s")) +logger.addHandler(stdout_log_handler) actions = { "getnodeid": [0x90, 0xE0],