code: def log_url (self, url_data, do_print):
          
          self.number += 1
          if not url_data.valid:
              self.errors += 1
              if do_print:
                  self.errors_printed += 1
          num_warnings = len(url_data.warnings)
          self.warnings += num_warnings
          if do_print:
              self.warnings_printed += num_warnings
          if url_data.content_type:
              key = url_data.content_type.split('/', 1)[0].lower()
              if key not in self.link_types:
                  key = "other"
          elif url_data.url.startswith(u"mailto:"):
              key = "mail"
          else:
              key = "other"
          self.link_types[key] += 1
          if url_data.url:
              l = len(url_data.url)
              self.max_url_length = max(l, self.max_url_length)
              if self.min_url_length == 0:
                  self.min_url_length = l
              else:
                  self.min_url_length = min(l, self.min_url_length)
              # track average number separately since empty URLs do not count
              self.avg_number += 1
              # calculate running average
              self.avg_url_length += (l - self.avg_url_length) / self.avg_number
docs: Log URL statistics.