window.log = function(){ if(!window.console ){ return; } var arr = [].slice.call(arguments); arr.unshift('(app)') console.log.apply(this,arr) ; } ; log(2)