r/javascript • • Dec 16 '18

Coming from Python to JS NSFW

const print = console.log

I found my safe space.

607 Upvotes

156 comments sorted by

View all comments

Show parent comments

6

u/13steinj Dec 17 '18

Aren't the 4 levels info, error, warn, (output to stderr), and log (output to stdout)?

1

u/Haramboid Dec 17 '18

Yes but that’s not very versatile. A good logger usually has multiple channels, separate from levels so you can categorize logs on the process you’re actually trying to debug.

4

u/mrbojingle Dec 17 '18

like console.group?

1

u/13steinj Dec 17 '18 edited Dec 17 '18

Well thats silly.

You can create any kind of grouping with console.group and console.groupEnd() if thats whag you mean, otherwise you either mean separate files or prefixed messages.

Which you can easily extend the console object to do, which you would extend by using one of the levels I mentioned.

If you mean to separate files, that's by definition not what the console is for.

Neither of which are a part of yourthe original argument~~, so you're moving the goalposts here. But okay~~.

E: I need to learn to read usernames.