Skip to content

Colorize console.error output to make it distinguishable #40361

@segrey

Description

@segrey

Is your feature request related to a problem? Please describe.

Node.js: 16.8.0

Currently, console.error(err) outputs plain text, so it doesn't bring attention when scrolling the output.

For example, Error: Server not ready is printed as plain text here:

image

Describe the solution you'd like

Would be great if console.error would produce output in red. As we can see in the screenshot, it already colors the stack trace (the lines are printed in dimmed color). Is it possible to extend coloring to print the error message in red?

Describe alternatives you've considered

One could use 3rd party packages like https://www.npmjs.com/package/colors, but it's not as convenient as having it out-of-the-box. Also, it's tricky to make it working with Error objects.

Related SO question: https://stackoverflow.com/questions/50608313/how-to-get-node-js-console-error-and-console-warn-output-in-color

Metadata

Metadata

Assignees

No one assigned

    Labels

    consoleIssues and PRs related to the console subsystem.feature requestIssues that request new features to be added to Node.js.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions