-
Notifications
You must be signed in to change notification settings - Fork 678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log Files Displaying Bad Format and Colors #1100
Comments
Hi @shlomi93 , Here is a code: from loguru import logger
if __name__ == '__main__':
logger.add("my_logger.log", rotation="03:30", colorize=False,
format="<green>{time}</green> <level>{message}</level>")
logger.info("logging some info")
logger.debug("logging some debug stuff")
logger.error("logging error") Log file:
|
Hi @shlomi93. As indicated by @smuglik (thanks), the The files does not conventionally support ANSI codes. There is no way to natively colorize the content of a file. If you want to see colors, the ANSI code would need to be reinterpreted and converted somehow, for example using a VS Code extension: ANSI Colors. |
Hi,
When I use the logger I can see the logs formatted and colored in the console (PyCharm)
But, when opening the actual file, I get unformatted raw ASCII. See pic below.
How can I fix this? Tried to open in many different txt editors, all seem to get the same result, including opening in PyCharm itself.
MacOS 14.3.1
In PyCharm console (during runtime or debugging)
When opening the actual file:
code:
The text was updated successfully, but these errors were encountered: