diff options
| -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, |
