Add more information when logging at DEBUG, LOUD.

This commit is contained in:
voussoir 2022-03-24 15:35:40 -07:00
parent 36e4a44bfb
commit 59b0916f88
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -53,7 +53,12 @@ def add_loud(log):
def add_root_handler(level): def add_root_handler(level):
handler = StreamHandler() 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) handler.setLevel(level)
root.addHandler(handler) root.addHandler(handler)
return handler return handler