[ACCEPTED]-Listening console.log-devtools

Accepted answer
Score: 14

Never tried this in a webpage, but it work 5 in a browser plugin (where javascripts rights 4 are are not the same for security reasons).

You 3 could definitively go for something like 2 this :


    var originallog = console.log;

    console.log = function(txt) {
        // Do really interesting stuff
        alert("I'm doing interesting stuff here !");

        originallog.apply(console, arguments);


The funny thing in javascript is that 1 function are objects too :D

Score: 3

This is a small hack, but I'm not sure there 1 is a better solution:

console._log_old = console.log
console.log = function(msg) {

More Related questions