def log(string, color='black', fire_event=True): color_hex = { 'green': '92m', 'yellow': '93m', 'red': '91m' } string = convert_to_utf8(string) if fire_event: manager.fire("logging", output=string, color=color) output = '[' + time.strftime("%Y-%m-%d %H:%M:%S") + '] ' + string if color in color_hex: output = "\033[" + color_hex[color] + output + "\033[0m" print(output) if LCD is not None and string is not None: LCD.message(string)
def log(string, color='black', fire_event=True): # type: (str, Optional[str], Optional[bool]) -> None color_hex = { 'green': Fore.GREEN, 'yellow': Fore.YELLOW, 'red': Fore.RED } string = str(string) if fire_event: manager.fire("logging", output=string, color=color) output = u"[" + time.strftime("%Y-%m-%d %H:%M:%S") + u"] " + string if color in color_hex: output = color_hex[color] + output + Style.RESET_ALL print(output) if LCD is not None and string is not None: LCD.message(string)
def log(string, color='black', fire_event=True): color_hex = { 'green': '92m', 'yellow': '93m', 'red': '91m' } string = convert_to_utf8(string) if fire_event: manager.fire("logging", output=string, color=color) output = '[' + time.strftime("%Y-%m-%d %H:%M:%S") + '] ' + string if color in color_hex: output = "\033[" + color_hex[color] + output + "\033[0m" if platform.system() == "Windows": print(output.encode('cp437', errors='replace').decode('cp437')) else: print(output) if LCD is not None and string is not None: LCD.message(string)
def log(string, color="black", prefix=None, fire_event=True): # type: (str, Optional[str], Optional[str], Optional[bool]) -> None if fire_event: manager.fire("logging", text=string, color=color, prefix=prefix) else: _log(text=string, color=color, prefix=prefix)
def log(text, color="black"): manager.fire("logging", text=text, color=color, prefix="Transfer")