Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colorize console.error output to make it distinguishable #40361

Closed
segrey opened this issue Oct 7, 2021 · 10 comments
Closed

Colorize console.error output to make it distinguishable #40361

segrey opened this issue Oct 7, 2021 · 10 comments
Labels
console Issues and PRs related to the console subsystem. feature request Issues that request new features to be added to Node.js.

Comments

@segrey
Copy link

segrey commented Oct 7, 2021

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

@VoltrexKeyva VoltrexKeyva added console Issues and PRs related to the console subsystem. feature request Issues that request new features to be added to Node.js. labels Oct 7, 2021
@targos targos moved this to Pending Triage in Node.js feature requests Apr 4, 2022
@targos targos moved this from Pending Triage to In Progress in Node.js feature requests Apr 4, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Apr 6, 2022

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.

@github-actions github-actions bot added the stale label Apr 6, 2022
@BobFrankston
Copy link

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.

@github-actions github-actions bot removed the stale label Apr 23, 2022
@github-actions
Copy link
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.

@github-actions github-actions bot added the stale label Oct 20, 2022
@segrey
Copy link
Author

segrey commented Oct 20, 2022

Still actual for node 19.0.0

@github-actions github-actions bot removed the stale label Oct 21, 2022
@github-actions
Copy link
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.

@github-actions github-actions bot added the stale label Apr 20, 2023
@bnoordhuis
Copy link
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.

@bnoordhuis bnoordhuis closed this as not planned Won't fix, can't repro, duplicate, stale Apr 20, 2023
@LunarTwilight
Copy link

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?

@ledlamp
Copy link

ledlamp commented Oct 21, 2023

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!

@HerozDotExe
Copy link

HerozDotExe commented Oct 25, 2023

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

@MrJithil MrJithil reopened this Feb 1, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Pending Triage in Node.js feature requests Feb 1, 2024
@github-actions github-actions bot removed the stale label Feb 2, 2024
@RedYetiDev
Copy link
Member

Completed by #51629

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
console Issues and PRs related to the console subsystem. feature request Issues that request new features to be added to Node.js.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants