Skip to content

Colorize console.error output to make it distinguishable #40361

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

Activity

  1. added
    consoleIssues and PRs related to the console subsystem.
    feature requestIssues requesting new Node.js features.
    on Oct 7, 2021
  2. moved this to Pending Triage in Node.js feature requestson Apr 4, 2022
  3. moved this from Pending Triage to In Progress in Node.js feature requestson Apr 4, 2022
  4. github-actions commented on Apr 6, 2022

    @github-actions
    Contributor

    There has been no activity on this feature request for 5 months and it is unlikely to be implemented. It will be closed 6 months after the last non-automated comment.

    For more information on how the project manages feature requests, please consult the feature request management document.

  5. added
    staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.
    on Apr 6, 2022
  6. BobFrankston commented on Apr 22, 2022

    @BobFrankston

    console.log outputs in color in visual studio code and supports %c. Having the same capability when writing to the console would be consistent and invaluable.

  7. removed
    staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.
    on Apr 23, 2022
  8. github-actions commented on Oct 20, 2022

    @github-actions
    Contributor

    There has been no activity on this feature request for 5 months and it is unlikely to be implemented. It will be closed 6 months after the last non-automated comment.

    For more information on how the project manages feature requests, please consult the feature request management document.

  9. added
    staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.
    on Oct 20, 2022
  10. segrey commented on Oct 20, 2022

    @segrey
    Author

    Still actual for node 19.0.0

  11. removed
    staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.
    on Oct 21, 2022
  12. github-actions commented on Apr 20, 2023

    @github-actions
    Contributor

    There has been no activity on this feature request for 5 months and it is unlikely to be implemented. It will be closed 6 months after the last non-automated comment.

    For more information on how the project manages feature requests, please consult the feature request management document.

  13. added
    staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.
    on Apr 20, 2023
  14. bnoordhuis commented on Apr 20, 2023

    @bnoordhuis
    Member

    The lack of feedback from either maintainers or users suggests there's not demand for this feature. I'll go ahead and close out the issue.

  15. LunarTwilight commented on Apr 22, 2023

    @LunarTwilight

    The lack of feedback from either maintainers or users suggests there's not demand for this feature. I'll go ahead and close out the issue.

    @bnoordhuis this is something that'd like to see implemented in nodejs, right now the solutions I've tried (including the one I've made) either don't do exactly what I want to do or don't work (eg loosing stack traces). Looking at the PR, it seems that it's ready for review?

  16. ledlamp commented on Oct 21, 2023

    @ledlamp

    pls different color for console.log, console.debug, console.warn and console.error. perhaps blue for debug, yellow for warn and red for error. would make development way nicer!

  17. HerozDotExe commented on Oct 25, 2023

    @HerozDotExe

    I would also love to have colors on console.error and console.warn please. In browsers devtools, these methods have differents colors...

  18. moved this from In Progress to Pending Triage in Node.js feature requestson Feb 1, 2024
  19. removed
    staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.
    on Feb 2, 2024
  20. avivkeller commented on Jun 26, 2024

    @avivkeller
    Member

    Completed by #51629

  21. moved this from Pending Triage to Done in Node.js feature requestson Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    consoleIssues and PRs related to the console subsystem.feature requestIssues requesting new Node.js features.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions