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

Need support for console.success #155

Closed
imvetri opened this issue Mar 4, 2019 · 1 comment
Closed

Need support for console.success #155

imvetri opened this issue Mar 4, 2019 · 1 comment

Comments

@imvetri
Copy link

imvetri commented Mar 4, 2019

Is your feature request related to a problem? Please describe.
Just like console.error, we need a console.success.

Describe the solution you'd like
When console.success is used, I would like to see output it in green colour.

Describe alternatives you've considered
Current workaround I have is to do console.log("Success: Order post is successful").

This will improve the confidence, way better than console.error.

@domfarolino
Copy link
Member

domfarolino commented Mar 4, 2019

So if you just wanted to write something indicating a successful operation, regular console.log is basically what that is for (due to default formatting and lack of scary warning/error formatting). I think there is more of a need to indicate that something went wrong, as opposed to right.

However if you wanted to improve that look, I think the best thing to do here is use something custom like the following (but a bit more generalized etc):

console.success = msg => {
  console.log(`%c${msg}`, 'color: green');
}

This will work in browsers, but not node (sadly we haven't gotten around to exactly specifying how the %c CSS format specifier should work, though browsers support it).

Furthermore, we couldn't really specify something the color green for console.success in this standard, as there's no history of this (or really any) standard specifying the UX bits of API results. This seems like something that could be abstracted over by a library or something, and might be less appropriate for this spec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants