From f9caa6042d2f90b30417b15aeb0388a96e7a8726 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Fri, 27 Mar 2020 21:03:10 +0100 Subject: fix: split logging colors utils --- src/frest/manage/utils.py | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) (limited to 'src/frest/manage/utils.py') diff --git a/src/frest/manage/utils.py b/src/frest/manage/utils.py index 30e3801..5aae18d 100644 --- a/src/frest/manage/utils.py +++ b/src/frest/manage/utils.py @@ -1,27 +1,17 @@ -class bcolors(object): - DARK_GREY = "\033[90m" - BOLD = "\033[1m" - ERROR = "\033[91m" - OK = "\033[92m" - WARNING = "\033[93m" - ENDC = "\033[0m" - - -COLORS = [ - bcolors.DARK_GREY, - bcolors.BOLD, - bcolors.ERROR, - bcolors.OK, - bcolors.WARNING, - bcolors.ENDC, -] -ENDC = len(COLORS) - 1 +import os +from .bcolors import COLORS + +ENDC = len(COLORS) - 1 def logging(text, _type=ENDC, end=""): print(f"{COLORS[_type]}{text}{COLORS[ENDC]}", end=end) +def logging_arg(text, *args): + args = [f"{COLORS[0]}{i}{COLORS[ENDC]}" for i in args] + print(text.format(*args), end="") + def logo(): print( """ -- cgit v1.2.3-71-g8e6c