I have a script that I can't change that makes a lot of console.log
calls. I want to add another layer and respond if the calls contain certain strings. This works in Firefox, but throws an "Illegal invocation
" error in Chrome on the 4th line:
var oldConsole = {};
oldConsole.log = console.log;
console.log = function (arg) {
oldConsole.log('MY CONSOLE!!');
oldConsole.log(arg);
}
Any ideas how to get around that? I also tried cloning the console...