Sunday, 1 September 2013

Javascript custom logging utility interferes with chrome inspector behaviour

Javascript custom logging utility interferes with chrome inspector behaviour

I am writing my own logging utility y overriding default console.log as
follows
console.logCopy = console.log.bind(console);
console.log = function() {
this.logCopy.apply(console, addStampToArgs(arguments));
};
I am using chrome's inspector for debugging.
My approach works fine except one issue which is now I am not able to use
chrome inspectors feature where it shows <file>:<line-number> for each log
line with a link to code.
Now it shows every log line originating from my console.log wrapper function.
How can I make my wrapper function to be un-trackable by console so that I
get the correct <file>:<line-number>?

No comments:

Post a Comment