Looks like I\'ve re-invented the wheel, but somehow this isn\'t working in Internet Explorer 9, but does in IE6.
function debug()
if(!window.console) {
Try:
function log(type) {
if (typeof console !== 'undefined' && typeof console.log !== 'undefined' &&
console[type] && Function.prototype.bind) {
var log = Function.prototype.bind.call(console[type], console);
log.apply(console, Array.prototype.slice.call(arguments, 1));
}
}
log('info', 'test', 'pass');
log('error', 'test', 'fail');
Works for log
, debug
, info
, warn
, error
, group
or groupEnd
.