loguru
loguru copied to clipboard
the problem with the log color using the coloring function
class Color(Enum):
scarlet = "scarlet"
pink = "pink"
orange = "orange"
blue = "blue"
purple = "purple"
from colorama import init, Fore, Style
init()
def colorize(color: Color, text: str) -> str:
match color:
case Color.scarlet:
return f"{Fore.RED}{text}{Style.RESET_ALL}"
case Color.pink:
return f"{Fore.MAGENTA}{text}{Style.RESET_ALL}"
case Color.blue:
return f"{Fore.CYAN}{text}{Style.RESET_ALL}"
case Color.orange:
return f"{Fore.YELLOW}{text}{Style.RESET_ALL}"
case _:
return f"{Fore.MAGENTA}{text}{Style.RESET_ALL}"
logger.info(f'111111111111111 {colorize(Color.orange, "2222222222222")} 11111111111111111111')
hi, I'm trying to write a part of a function that will color some phrases of my blog and for some reason, when using this function, all the text that comes after using this coloring turns red. Can you help me? thanks