Created
October 24, 2011 06:46
-
-
Save hejrobin/1308501 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
this.log = function() { | |
// Really old browsers | |
if(typeof console == undefined) | |
var console = {}; | |
// Just makin' sure... | |
if(typeof console.log == undefined) | |
console.log = function() {}; | |
// Now we're talkin' | |
else if(typeof console == 'function') { | |
if(arguments.length == 1) | |
arguments = arguments[0]; | |
console.log(arguments); | |
} | |
// Dude, what... ffffuuuuu.jpg sent to IE9 | |
else if(Function.prototype.bind && typeOf(console.log) == 'object') { | |
// In IE9, console.log is an object and not a function | |
["log","info","warn","error","assert","dir","clear","profile","profileEnd"].each(function(method) { | |
console[method] = this.bind(console[method], console); | |
}, Function.prototype.call); | |
} | |
}; | |
}).call(window); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment