Which solution do you recommend, the second is simpler ( less code ), but there are drawbacks on using it ?
First: (Set a global debug flag)
window.console = window.console || {}; window.console.log = window.console.log || function() {};