code: def check_url(url_data, logger):
      
      if url_data.has_result:
          logger.log_url(url_data.to_wire())
      else:
          cache = url_data.aggregate.result_cache
          key = url_data.cache_url
          result = cache.get_result(key)
          if result is None:
              # check
              check_start = time.time()
              try:
                  url_data.check()
                  do_parse = url_data.check_content()
                  url_data.checktime = time.time() - check_start
                  # Add result to cache
                  result = url_data.to_wire()
                  cache.add_result(key, result)
                  for alias in url_data.aliases:
                      # redirect aliases
                      cache.add_result(alias, result)
                  # parse content recursively
                  # XXX this could add new warnings which should be cached.
                  if do_parse:
                      parser.parse_url(url_data)
              finally:
                  # close/release possible open connection
                  url_data.close_connection()
          else:
              # copy data from cache and adjust it
              result = copy.copy(result)
              result.parent_url = url_data.parent_url
              result.base_ref = url_data.base_ref or u""
              result.base_url = url_data.base_url or u""
              result.line = url_data.line
              result.column = url_data.column
              result.level = url_data.recursion_level
              result.name = url_data.name
          logger.log_url(result)
docs: Check a single URL with logging.