I use console.log for debugging on my web app, I have a flag variable:
var is_dev = true;
I want the console.log only runs when is_dev == true;
this is the code I used:
jQuery.extend({
log : function() {
if (is_dev) {
if (console) {
console.log.apply(console, arguments);
}
}
}
});
now I use $log('some text', someValue);
and it's working fine, the problem is that it always shows the console line number of the $log function. I want to show also the line number of the logged text where it happened..
I don't want to go to each line and check for is_dev there, non practical and I have hundreds of them there.
Any ideas? thanks in advance.