code: def log_exception(
          self,
          typ: "Optional[Type[BaseException]]",
          value: Optional[BaseException],
          tb: Optional[TracebackType],
      ) -> None:
          
          if isinstance(value, HTTPError):
              if value.log_message:
                  format = "%d %s: " + value.log_message
                  args = [value.status_code, self._request_summary()] + list(value.args)
                  gen_log.warning(format, *args)
          else:
              app_log.error(  # type: ignore
                  "Uncaught exception %s\n%r",
                  self._request_summary(),
                  self.request,
                  exc_info=(typ, value, tb),
              )
docs: Override to customize logging of uncaught exceptions.
  
          By default logs instances of `HTTPError` as warnings without
          stack traces (on the ``tornado.general`` logger), and all
          other exceptions as errors with stack traces (on the
          ``tornado.application`` logger).
  
          .. versionadded:: 3.1