Catch console.log but keep information of caller in browser's console

Viewed 51

Can I catch console.log calls but still show the correct caller information / link to source code in the browser's console?

I know I can do

myModule.js

  var oldLog = console.log;
  console.log = function (message) {
    // ... I want to do something here in this line ...  
    oldLog.apply(console, arguments);
  }

But when I do this, then the browser's console will always show myModule.js as the source of the log message. Not the module that actually called the (overwritten) console.log() method.

0 Answers
Related