papermario/tools/splat/util/log.py
Ethan Roseman dc72859546 rename
2021-01-25 00:19:48 +09:00

33 lines
676 B
Python

from colorama import init, Fore, Style
init(autoreset=True)
newline = True
def write(*args, status=None, **kwargs):
global newline
if not newline:
print("")
newline = True
print(status_to_ansi(status) + str(args[0]), *args[1:], **kwargs)
def dot(status=None):
global newline
print(status_to_ansi(status) + ".", end="")
newline = False
def status_to_ansi(status):
if status == "ok":
return Fore.GREEN
elif status == "warn":
return Fore.YELLOW + Style.BRIGHT
elif status == "error":
return Fore.RED + Style.BRIGHT
elif status == "skip":
return Style.DIM
else:
return ""