Console.log Hijacker

Hey All.

About 7 years ago (back in the days), I wrote some javascript that takes over the console.log, console.warn and console.error functions and outputs the logging to a div within a page in your app. This allows you to do some debugging out in the wild (or without plugging a device into a computer - which is really useful for those who don’t have a mac).

I just did a major rewrite (while I was forced to sit still on the couch) and updated the github repository which you can find here:


1 Like

I just want to say, that’s awesome! Thank you, this will come in handy.

What if I want to use it in a regular web-app – any changes required?

(I know the console is readily accessible, but if I have an end-user reporting a problem it would be handy to just display any errors in a showable DIV instead of asking users to open up and navigate the inspector.)

You can use it on a regular web app. However, when you take over the console, no console.logs generated within the webapp will display in the browsers console (I don’t chain back).

As for the end-user reporting, I have a settings switch “report errors” and when it’s on, I run this and then use ajax call to the server to report them. The server side gets the userid, a json string with all the errors, the device type, OS, OS version etc and all that gets stored in a table. I can view errors by device, os, os version, user etc.

1 Like

This is a great little feature - thank you for sharing this!

Thanks George. I wrote the first version many years ago when I was building on Phonegap (before IntelXDK) and before I had a Mac. It’s a handy little tool for debugging in the wild (like when you’re doing geo intensive work) or when your code works on one os/device but not another.