From 60f0bc6464bcb2ee7207426664956ba5277a153b Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Tue, 23 Jun 2026 14:57:25 +0200 Subject: shorter level names in log output --- project/utils.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'project') diff --git a/project/utils.py b/project/utils.py index f8c0dd8..d20f4c1 100644 --- a/project/utils.py +++ b/project/utils.py @@ -46,11 +46,20 @@ def full_exe_name(exe): @contextmanager def setup_logging(): + level_names = { + logging.DEBUG: 'DBG', + logging.INFO: 'INFO', + logging.WARNING: 'WARN', + logging.ERROR: 'ERR', + logging.CRITICAL: 'CRIT', + } + for lvl, name in level_names.items(): + logging.addLevelName(lvl, name) + logging.basicConfig( level=logging.INFO, datefmt='%Y-%m-%d %H:%M:%S%z', - # The 8 below is for "CRITICAL" - format='%(asctime)s | %(levelname)8s | %(message)s', + format='%(asctime)s | %(levelname)4s | %(message)s', # Log to stdout, because that's where subprocess's output goes (so that # they don't get interleaved). stream=sys.stdout, -- cgit v1.3