As we know console is not exists in IE without inspecting in developer mode. So our simple code will run on IE 8 . If console will available it will log or else it will alert message if fallback set to true.
_console.log('Data');
(function() { logenabled = true, fallbackalert = true, _console = { log: function (val) { if (console != null && console != 'undefined' && logenabled) { console.log("My console: " + val); } else { if(fallbackalert){ alert(val); } } } } }());
_console.log('Data');