Skip to content

Please fix logging color on windows console #943

Closed
@afshin

Description

@afshin

@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

  1. Run jupyter lab
  2. 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. jupyterlab/jupyterlab#12917

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions