From 59b0916f88f3f55610b895a7dc997039d3428f7b Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Thu, 24 Mar 2022 15:35:40 -0700 Subject: [PATCH] Add more information when logging at DEBUG, LOUD. --- voussoirkit/vlogging.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/voussoirkit/vlogging.py b/voussoirkit/vlogging.py index e421902..9ced9f9 100644 --- a/voussoirkit/vlogging.py +++ b/voussoirkit/vlogging.py @@ -53,7 +53,12 @@ def add_loud(log): def add_root_handler(level): handler = StreamHandler() - handler.setFormatter(Formatter('{levelname}:{name}:{message}', style='{')) + if level <= LOUD: + handler.setFormatter(Formatter('{levelname}:{name}.{funcName}.{lineno}:{message}', style='{')) + elif level <= DEBUG: + handler.setFormatter(Formatter('{levelname}:{name}.{funcName}:{message}', style='{')) + else: + handler.setFormatter(Formatter('{levelname}:{name}:{message}', style='{')) handler.setLevel(level) root.addHandler(handler) return handler