Tools: Firefox & Firebug or Safari
Library:
function ConsoleLogger(level)
{
this.level=level||4;
this.start=function(){};
this.log=function(msg,level){
level=level||0;
if(level>this.level)return;
if(typeof(console)==’undefined’)return;
try{
switch(level){case 0:console.warn(msg);break;
case 1:console.error(msg);break;
case 2:console.info(msg);break;
case 4:console.debug(msg);break;
default:console.log(msg);break;
}
}catch(e){
try{console.log(msg)}catch(e){}
}
};
this.setLevel=function(level){
this.level=level;return this;
};
this.getLevel=function(){
return this.level;
};
}
Example:
oDbg = new ConsoleLogger(2);
oDbg.log(“warn info: ….”, 0);
oDbg.log(“error info: ….”, 1);
oDbg.log(“info info: ….”, 2);
oDbg.log(“debug info: ….”, 4);

You can get the debug information in the console of Firebug.

Also see:

Subscribe in reader