// define a new console var console=(function(oldCons){ return { log: function(text){ oldCons.log(text); parent.document.body.getElementsByTagName("notification-bubbles")[0].add(text, 'log'); }, info: function (text) { oldCons.info(text); parent.document.body.getElementsByTagName("notification-bubbles")[0].add(text, 'info'); }, warn: function (text) { oldCons.warn(text); parent.document.body.getElementsByTagName("notification-bubbles")[0].add(text, 'warn'); }, error: function (text) { oldCons.error(text); parent.document.body.getElementsByTagName("notification-bubbles")[0].add(text, 'error'); } }; }(window.console)); //Then redefine the old console window.console = console;