I'm experimenting with ways to redirect output from the javascript console to my own custom functions.
Here's what I've attempted:
window.console.error = window.console.debug = window.console.log
window.console.log = mylog;
function mylog(msg){
// Sending it somewhere, just using alert as an example
alert("log=" + msg);
}
console.log("yo");
var x = y; // A syntax error
With the above code, I only receive the following alert: "yo"
In the console log, I get: "x is not defined"
How can I capture and redirect syntax errors?