Only log to window.console if it exists

Some browsers (IE) only have window.console defined if the developer tools window is open. This change removes the assumption that the console object is always defined.