Open fopina opened 1 year ago
Using init(strip=True) to disable colors works for print statements, such as:
init(strip=True)
print
>>> from colorama import init, Fore >>> print(f'{Fore.RED}test{Fore.RESET}') test (COLORED) >>> init(strip=True) >>> print(f'{Fore.RED}test{Fore.RESET}') test (NO COLOR)
But it does not for logging statements
>>> from colorama import init, Fore >>> init(strip=True) >>> import logging >>> logging.error(f'{Fore.RED}oi{Fore.RESET}') ERROR:root:oi (STILL COLORED)
I'm currently using this workaround in my CLI main/parser entrypoint:
# FIXME: colorama strip fails in logging...! # monkeypatch Fore class FakeFore: def __getattribute__(self, __name: str): return '' Fore.__class__ = FakeFore
But it would be nice to have stripping actually working...
Using
init(strip=True)
to disable colors works forprint
statements, such as:But it does not for logging statements
I'm currently using this workaround in my CLI main/parser entrypoint:
But it would be nice to have stripping actually working...