diff options
| author | Egor Tensin <egor@tensin.name> | 2026-06-23 14:57:25 +0200 |
|---|---|---|
| committer | Egor Tensin <egor@tensin.name> | 2026-06-23 14:57:25 +0200 |
| commit | 60f0bc6464bcb2ee7207426664956ba5277a153b (patch) | |
| tree | 06febaefa554a0016737a4ee50ad9cf4db7672f4 /project | |
| parent | prettier log output (diff) | |
| download | cmake-common-60f0bc6464bcb2ee7207426664956ba5277a153b.tar.gz cmake-common-60f0bc6464bcb2ee7207426664956ba5277a153b.zip | |
shorter level names in log output
Diffstat (limited to 'project')
| -rw-r--r-- | project/utils.py | 13 |
1 files changed, 11 insertions, 2 deletions
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, |
