jupyter_server
jupyter_server copied to clipboard
Please fix logging color on windows console
@char101 opened an issue on JupyterLab that seems like it is likely to be addressable in jupyter_server. What do you think?
Description
It seems that jupyter uses tornado.log for logging. In the comment of tornado.log it is written
Color support on Windows versions that do not support ANSI color codes is
enabled by use of the colorama__ library. Applications that wish to use
this must first initialize colorama with a call to ``colorama.init``.
See the colorama documentation for details.
Unfortunately colorama.init() is never called by jupyter causing logging ANSI color to be output as raw escape codes.
Reproduce
- Run jupyter lab
- Log shows raw ANSI escape sequences for color
←[2;32m[I 2022-08-07 18:50:14.236 ServerApp]←[0m
Expected behavior
Colored log in windows console.
Context
- Operating System and version: Windows 10
- Browser and version: N/A
- JupyterLab version: 3.4.4
Resolution
If possible please add colorama.init() in the main code
try:
import colorama
colorama.init()
except ImportError:
pass
cf. https://github.com/jupyterlab/jupyterlab/issues/12917
@afshin - thank you for forwarding the issue here. This makes sense.
@char101 - great write-up! Is this a change you'd like to contribute? I think the suggested change would simply go into the imports area of serverapp.py. if this is something you'd rather defer to someone else, that's fine too.
Since this is only a small change I would prefer to defer to someone else, thank you.