[ACCEPTED]-Listening console.log-devtools
Accepted answer
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 :
(function(){
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
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) {
alert(msg);
console._log_old(msg);
}
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.