refactor(debug): Cosmetics
This commit is contained in:
parent
357db8f1e0
commit
c3179fb681
@ -1,6 +1,6 @@
|
|||||||
# Exit with various exit codes
|
# Exit with various exit codes
|
||||||
import sys
|
import sys
|
||||||
# Path manipulation
|
# Path and env manipulation
|
||||||
import os
|
import os
|
||||||
# Manipulate style and content of logs
|
# Manipulate style and content of logs
|
||||||
import logging
|
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"]]
|
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(
|
logging.basicConfig(
|
||||||
# Default for all modules is NOTSET so log everything
|
# Default for all modules is NOTSET so log everything
|
||||||
level="NOTSET",
|
level="NOTSET",
|
||||||
format=CONST.LOG_FORMAT,
|
format=CONST.LOG_FORMAT,
|
||||||
datefmt="[%X]",
|
datefmt="[%X]",
|
||||||
handlers=[RichHandler(
|
handlers=[RichHandler(
|
||||||
show_time=False if any([systemd_env_var in os.environ for systemd_env_var in [
|
show_time=False if is_systemd else True,
|
||||||
"SYSTEMD_EXEC_PID",
|
show_path=False if is_systemd else True,
|
||||||
"INVOCATION_ID"]]) else True,
|
show_level=False if is_systemd else True,
|
||||||
rich_tracebacks=True,
|
rich_tracebacks=True
|
||||||
show_path=False,
|
|
||||||
show_level=False
|
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
log = logging.getLogger("rich")
|
log = logging.getLogger("rich")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user