ge35zg
Last Updated: February 25, 2016
·
2.916K
· dpashkevich
D42a7264714dee5006b9c99d2567a320

Use console.error() instead of console.trace()

What's always been annoying me about console.trace() is that the stack trace is always expanded when output to the console. This quickly obstructs the view if you perform many traces at a time.

What I found is that console.error() actually logs stack trace in the same way, only it's initially collapsed (see screenshot). As a bonus you can optionally pass a message that would serve as a title for your trace.

console.error() vs console.trace()

Now I always prefer the former and have cleaner output!

P.S. Also true for FireBug!

Say Thanks
Respond

2 Responses
Add your response

4316
Avatar3

Also console.debug()

over 1 year ago ·
5287
D42a7264714dee5006b9c99d2567a320

@shell Great find, thanks! Looks like at the moment it's identical to log but has more letters :)

over 1 year ago ·