Reputation: 91
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?
Upvotes: 6
Views: 1910
Reputation: 360
You need to eval a script in the inspectedWindow:
chrome.devtools.inspectedWindow.eval('console.log("test")')
Upvotes: 2
Reputation: 10927
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);
};
Upvotes: 2