Removed match for python < 3.10

This commit is contained in:
jeancf 2022-12-21 09:41:59 +01:00
parent 333470e623
commit ed3e0b1fd6

View File

@ -634,24 +634,29 @@ def main(argv):
datefmt='%Y-%m-%d %H:%M:%S', datefmt='%Y-%m-%d %H:%M:%S',
) )
# Set level of logging # Set default level of logging
log_level = logging.WARNING log_level = logging.WARNING
match TOML['options']['log_level'].upper():
case 'DEBUG': # log level as an uppercase string from config
ll_str = TOML['options']['log_level'].upper()
if ll_str == "DEBUG":
log_level = logging.DEBUG log_level = logging.DEBUG
case 'INFO': elif ll_str == "INFO":
log_level = logging.INFO log_level = logging.INFO
case 'WARNING': elif ll_str == "WARNING":
log_level = logging.WARNING log_level = logging.WARNING
case 'ERROR': elif ll_str == "ERROR":
log_level = logging.ERROR log_level = logging.ERROR
case 'CRITICAL': elif ll_str == "CRITICAL":
log_level = logging.CRITICAL log_level == logging.CRITICAL
case 'OFF': elif ll_str == "OFF":
# Disable all logging # Disable all logging
logging.disable(logging.CRITICAL) logging.disable(logging.CRITICAL)
case _: else:
logging.error('Invalid log_level %s in config file. Using WARNING.', str(TOML['options']['log_level'])) logging.error('Invalid log_level %s in config file. Using WARNING.', str(TOML['options']['log_level']))
# Set desired level of logging
logger = logging.getLogger() logger = logging.getLogger()
logger.setLevel(log_level) logger.setLevel(log_level)