Open vikramsubramanian opened 3 months ago
colorize=False
in the handler configuration to disable ANSI color codes when logs are being written to Apache WSGI logs.colorize
parameter is set based on the output stream's ability to handle ANSI color codes. Use the should_colorize
function from _colorama.py
to determine if the output stream supports colorization.add
method in _logger.py
to conditionally set colorize
based on the output stream:
if colorize is None:
colorize = _colorama.should_colorize(sink)
I integrated loguru with a django application with this handler.
When I try to use django's inbuilt webserver to serve the application, the colors are shown just fine but for production environment, I use Apache WSGI to serve django application, the logs print fine in apache logs, but the colors are shown as codes instead of the actual color.
\x1b[32m2023 Sun Nov 26 23:44:55.622738+0000\x1b[0m
- Apache Logs![image]( - Django Development Server logs
I tested Apache Logs both on gitbash and command prompt
)