IE8 compatibility, only log to console if defined