6

I am extending Google Chrome with the "chrome.devtools.panels.create" API, it means that I have now some logic in my browser by which I need to debug.

Is there anyway to see the Console log / Debug my DevTools additions?

Wladimir Palant
  • 56,865
  • 12
  • 98
  • 126

2 Answers2

2

If all you need is console.log you can wrap it up. Actually it works for any other function, not just console.log but here's example for wrapping console.log:

console._log = console.log;
console.log = function(){ 
    // you can do whatever you want with arguments, output to div, alert / etc.
    return console._log.apply(console,arguments); 
};
Silviu-Marian
  • 10,565
  • 6
  • 50
  • 72
2

You need to eval a script in the inspectedWindow:

chrome.devtools.inspectedWindow.eval('console.log("test")')

jdprc06
  • 360
  • 3
  • 7