refactor(debug): Cosmetics

This commit is contained in:
hygienic-books 2022-07-05 19:55:08 +02:00
parent 357db8f1e0
commit c3179fb681

@ -1,6 +1,6 @@
# Exit with various exit codes
import sys
# Path manipulation
# Path and env manipulation
import os
# Manipulate style and content of logs
import logging
@ -76,18 +76,17 @@ class CONST(object):
CFG_MANDATORY = [section_cfg["key"] for section_cfg in CFG_KNOWN_SECTION if section_cfg["is_mandatory"]]
is_systemd = any([systemd_env_var in os.environ for systemd_env_var in ["SYSTEMD_EXEC_PID", "INVOCATION_ID"]])
logging.basicConfig(
# Default for all modules is NOTSET so log everything
level="NOTSET",
format=CONST.LOG_FORMAT,
datefmt="[%X]",
handlers=[RichHandler(
show_time=False if any([systemd_env_var in os.environ for systemd_env_var in [
"SYSTEMD_EXEC_PID",
"INVOCATION_ID"]]) else True,
rich_tracebacks=True,
show_path=False,
show_level=False
show_time=False if is_systemd else True,
show_path=False if is_systemd else True,
show_level=False if is_systemd else True,
rich_tracebacks=True
)]
)
log = logging.getLogger("rich")