Debug flag now set in config file
This commit is contained in:
@@ -42,8 +42,11 @@ def log(level, msg):
|
||||
print(f"[{_ts()}] {level:5s} {msg}")
|
||||
|
||||
|
||||
_DEBUG = False
|
||||
|
||||
|
||||
def info(msg):
|
||||
if _cfg.get("debug", False):
|
||||
if _DEBUG:
|
||||
log("INFO", msg)
|
||||
|
||||
|
||||
@@ -76,6 +79,10 @@ def _load_config():
|
||||
|
||||
_cfg = _load_config()
|
||||
|
||||
DEBUG = _cfg.get("debug", False)
|
||||
global _DEBUG
|
||||
_DEBUG = DEBUG
|
||||
|
||||
WIFI_SSID = _cfg["wifi_ssid"]
|
||||
WIFI_PASSWORD = _cfg["wifi_password"]
|
||||
MQTT_BROKER = _cfg["mqtt_broker"]
|
||||
|
||||
Reference in New Issue
Block a user