Mayil-AI-Sandbox / loguru-Jan2023

MIT License
0 stars 0 forks source link

Is there an easy way to temporarily disable colors? (hashtag578) #127

Closed vikramsubramanian closed 2 weeks ago

vikramsubramanian commented 2 weeks ago

The colors are helpful but they get in the way when a terminal doesn't support it - in my case, VS Code's Python Debugger prints the color codes and makes it hard to read:

←[32m2022-01-26 12:10:13.464←[0m | ←[1mINFO    ←[0m | ←[36mapp.main←[0m:←[36m<module>←[0m:←[36m17←[0m - ←[1mmessage

Is there a simple way to disable them temporarily, eg setting an environment variable?

vikramsubramanian commented 2 weeks ago

You can either add() your sink with colorize=False or override the default by settings the LOGURU_COLORIZE environment vairale to NO.

vikramsubramanian commented 2 weeks ago

Great, I configured that variable in the debugger and it does exactly what I need.

Thanks for the help Delgan!