Reputation: 2027
Looking for a way to log on my server all console events shown on my visitor's browser console. Not just what I'm firing with console.log, but everything... Is there a way?
Upvotes: 2
Views: 1575
Reputation: 1072
Yes you can just override console method like
var logFn = console.log;
console.log = function(arg1) {
// do your work on log information
logFn('your console hacked')
}
console.error = function(arg1) {
// do your work on error part
logFn('your console hacked')
}
you will find on console only one message 'your console hacked' you can customize according to you.
Upvotes: 1