if (typeof log == 'undefined') {
  function log(msg) {
    if (typeof console == 'object' && typeof console.log == 'function') {
      console.log(msg);
    }
  }
}
