(function() { var console = namespace("console"); var tabs = namespace("tabs"); function execute(f, arg) { tabs.current.inject("console." + f + ".apply(console, JSON.parse(arguments[0]));", JSON.stringify(Array.prototype.slice.call(arguments, 1))); } var i, method; var o = {}; var methods = [ "assert", "count", "debug", "error", "group", "groupCollapsed", "groupEnd", "info", "log", "time", "timeEnd", "warn" ]; for (i = methods.length-1; i>=0; --i) { method = methods[i]; o[method] = { value : execute.bind(null, method) }; } Object.defineProperties(console, o); Object.freeze(console); })(); 