Saturday, July 05, 2014

How to get real line numbers in Chrome when using a wrapped console.log function

If you use a wrapped console.log function in your javascript, it's rather annoying that the console log entries always refer to the wrapping function rather than the relevant line in your source code.

Fortunately, Chrome has a workaround Tips and Tricks: Ignoring library code while debugging in Chrome (remember to open and close dev tools as described in the article)

There are a number of good reasons to wrap your console log calls, firstly handling old browsers which don't always have a console and secondly, keeping a buffer of console logs which can be included when capturing and reporting client side errors

While on the subject of client side errors, Tracekit is a useful library which provides stack traces for javascript errors