code: def log_message(self, format, *args):
          
          code = args[1][0]
          levels = {
              '4': 'warning',
              '5': 'error'
          }
  
          log_handler = getattr(logger, levels.get(code, 'info'))
          log_handler(format % args)
docs: overrides the ``log_message`` method from the wsgiref server so that
          normal logging works with whatever configuration the application has
          been set to.
  
          Levels are inferred from the HTTP status code, 4XX codes are treated as
          warnings, 5XX as errors and everything else as INFO level.