Now with 30% less sugar

This commit is contained in:
Tediore 2021-08-18 00:05:24 -05:00
parent d3b2e5e428
commit d1858c3aff

View File

@ -19,7 +19,11 @@ TIME_REMAINING = int(os.getenv('TIME_REMAINING', 1))
AC_ADAPTER = int(os.getenv('AC_ADAPTER', 0))
LOG_LEVEL = os.getenv('LOG_LEVEL', 'INFO').upper()
logging.basicConfig(level=LOG_LEVEL, format='%(asctime)s %(levelname)s: %(message)s')
if LOG_LEVEL.lower() not in ['debug', 'info', 'warning', 'error']:
logging.basicConfig(level='INFO', format='%(asctime)s %(levelname)s: %(message)s')
logging.warning(f'Selected log level "{LOG_LEVEL}" is not valid; using default')
else:
logging.basicConfig(level=LOG_LEVEL, format='%(asctime)s %(levelname)s: %(message)s')
client = mqtt.Client("battery2mqtt")