#!/usr/bin/python3 import sys #if "--err-log" in sys.argv: #f=open("/tmp/librelight-err.log","a") icolor = 1 def cprint(*text,color="blue",space=" ",end="\n"): #return 0 #disable print dbg if not color: print(text) return 0 if color == "green": txt = '\033[92m' elif color == "red": txt = '\033[0;31m\033[1m' try: f.write(str(text)+";\n") f.flush() except:pass elif color == "yellow": txt = '\033[93m\033[1m' elif color == "cyan": txt = '\033[96m' else: txt = '\033[94m' for t in text: txt += str(t ) +" " #HEADER = '\033[95m' #OKBLUE = '\033[94m' #OKCYAN = '\033[96m' #OKGREEN = '\033[92m' #WARNING = '\033[93m' #FAIL = '\033[91m' #ENDC = '\033[0m' #BOLD = '\033[1m' #UNDERLINE = '\033[4m' txt += '\033[0m' print(txt,end=end) #return txt try: sys.stdout.flush() # to grep output except BrokenPipeError as e: print("BROKEN PIPE ERROR CPRINT = EXIT") #exit()