mirror of
https://gitlab.com/jeancf/twoot.git
synced 2024-11-23 20:11:11 +00:00
Removed match for python < 3.10
This commit is contained in:
parent
333470e623
commit
ed3e0b1fd6
39
twoot.py
39
twoot.py
|
@ -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
|
||||||
log_level = logging.DEBUG
|
ll_str = TOML['options']['log_level'].upper()
|
||||||
case 'INFO':
|
|
||||||
log_level = logging.INFO
|
if ll_str == "DEBUG":
|
||||||
case 'WARNING':
|
log_level = logging.DEBUG
|
||||||
log_level = logging.WARNING
|
elif ll_str == "INFO":
|
||||||
case 'ERROR':
|
log_level = logging.INFO
|
||||||
log_level = logging.ERROR
|
elif ll_str == "WARNING":
|
||||||
case 'CRITICAL':
|
log_level = logging.WARNING
|
||||||
log_level = logging.CRITICAL
|
elif ll_str == "ERROR":
|
||||||
case 'OFF':
|
log_level = logging.ERROR
|
||||||
# Disable all logging
|
elif ll_str == "CRITICAL":
|
||||||
logging.disable(logging.CRITICAL)
|
log_level == logging.CRITICAL
|
||||||
case _:
|
elif ll_str == "OFF":
|
||||||
logging.error('Invalid log_level %s in config file. Using WARNING.', str(TOML['options']['log_level']))
|
# Disable all logging
|
||||||
|
logging.disable(logging.CRITICAL)
|
||||||
|
else:
|
||||||
|
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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user