code: def try_to_set_up_global_logging():
      
      root = logging.getLogger()
      root.setLevel(logging.DEBUG)
      formatter = logging.Formatter(
          '%(asctime)s %(levelname)-7s %(threadName)-10s:%(process)d [%(filename)s:%(funcName)s():%(lineno)s] %(message)s')
  
      if env.is_debug():
          handler = logging.StreamHandler()
          handler.setLevel(logging.DEBUG)
          handler.setFormatter(formatter)
  
          root.addHandler(handler)
  
      try:
          handler = logging.FileHandler(GLOBAL_LOG_FNAME, mode='w')
          handler.setLevel(logging.DEBUG)
          handler.setFormatter(formatter)
  
          root.addHandler(handler)
      except IOError as e:  # eg. in case wandb directory isn't writable
          termerror('Failed to set up logging: {}'.format(e))
          return False
  
      return True
docs: Try to set up global W&B debug log that gets re-written by every W&B process.
  
      It may fail (and return False) eg. if the current directory isn't user-writable