Skip to content

Instantly share code, notes, and snippets.

@aponxi
Created September 30, 2014 00:52
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save aponxi/350df3da2b9f34ba8788 to your computer and use it in GitHub Desktop.
Console Take Over
function cnsl(){
var console = window.console
if (!console) return
function intercept(method){
var original = console[method]
console[method] = function(){
// do sneaky stuff
if (original.apply){
// Do this for normal browsers
original.apply(console, arguments)
}else{
// Do this for IE
var message = Array.prototype.slice.apply(arguments).join(' ')
original(message)
}
}
}
var methods = ['log', 'warn', 'error']
for (var i = 0; i < methods.length; i++)
intercept(methods[i])
}
Copy link

ghost commented Mar 19, 2017

What does this do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment