console.log when firebug exists or not

//sometimes we forget to comment firebug console.log statement in production web
//and spawn lots of errors, here's the code on how to override console.log method when
//firebug not exists

(function(__global){
  if (!__global.console || (__global.console && !__global.console.log)) {
    __global.console = {
      log: (__global.opera && __global.opera.postError)
        ? __global.opera.postError
        : function(){ }
    }
  }
})(this);

2 Comments

  1. gravatar
    knut said:

    Any ideas how to overwrite the firebug console to get no logging in production?

    2009-02-04 17:27

Post A Comment