Better error handling, Efforts to run non-root with occasional sudo
This commit is contained in:
parent
808271f3e0
commit
f980cdb464
7 changed files with 90 additions and 47 deletions
|
|
@ -7,14 +7,17 @@ class NoTracebackStreamHandler(logging.StreamHandler):
|
|||
info, cache = record.exc_info, record.exc_text
|
||||
record.exc_info, record.exc_text = None, None
|
||||
|
||||
if record.levelname == 'WARNING':
|
||||
color = colorama.Fore.YELLOW
|
||||
elif record.levelname in ['ERROR', 'EXCEPTION']:
|
||||
if record.levelname in ['WARNING', 'WARN']:
|
||||
color = colorama.Fore.LIGHTYELLOW_EX
|
||||
elif record.levelname == 'ERROR':
|
||||
color = colorama.Fore.LIGHTRED_EX
|
||||
elif record.levelname == 'INFO':
|
||||
color = colorama.Fore.LIGHTBLUE_EX
|
||||
color = colorama.Fore.LIGHTGREEN_EX
|
||||
elif record.levelname == 'CRITICAL':
|
||||
color = colorama.Fore.LIGHTCYAN_EX
|
||||
else:
|
||||
color = colorama.Fore.WHITE
|
||||
|
||||
try:
|
||||
print(color, end='', flush=True)
|
||||
super().handle(record)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue