parameters: (verbosity, no_color, user_log_file)
return_statement: return level_number
docstring: Configures and sets up all of the logging
  
      Returns the requested logging level, as its integer value.
docstring_summary: Configures and sets up all of the logging
docstring_tokens: Configures and sets up all of the logging
function: def setup_logging(verbosity, no_color, user_log_file):
      """Configures and sets up all of the logging
  
      Returns the requested logging level, as its integer value.
      """
  
      # Determine the level to be logging at.
      if verbosity >= 1:
          level = "DEBUG"
      elif verbosity == -1:
          level = "WARNING"
      elif verbosity == -2:
          level = "ERROR"
      elif verbosity <= -3:
          level = "CRITICAL"
      else:
          level = "INFO"
  
      level_number = getattr(logging, level)
  
      # The "root" logger should match the "console" level *unless* we also need
      # to log to a user log file.
      include_user_log = user_log_file is not None
      if include_user_log:
          additional_log_file = user_log_file
          root_level = "DEBUG"
      else:
          additional_log_file = "/dev/null"
          root_level = level
  
      # Disable any logging besides WARNING unless we have DEBUG level logging
      # enabled for vendored libraries.
      vendored_log_level = "WARNING" if level in ["INFO", "ERROR"] else "DEBUG"
  
      # Shorthands for clarity
      log_streams = {
          "stdout": "ext://sys.stdout",
          "stderr": "ext://sys.stderr",
      }
      handler_classes = {
          "stream": "pip._internal.utils.logging.ColorizedStreamHandler",
          "file": "pip._internal.utils.logging.BetterRotatingFileHandler",
      }
      handlers = ["console", "console_errors", "console_subprocess"] + (
          ["user_log"] if include_user_log else []
      )
  
      logging.config.dictConfig({
          "version": 1,
          "disable_existing_loggers": False,
          "filters": {
              "exclude_warnings": {
                  "()": "pip._internal.utils.logging.MaxLevelFilter",
                  "level": logging.WARNING,
              },
              "restrict_to_subprocess": {
                  "()": "logging.Filter",
                  "name": subprocess_logger.name,
              },
              "exclude_subprocess": {
                  "()": "pip._internal.utils.logging.ExcludeLoggerFilter",
                  "name": subprocess_logger.name,
              },
          },
          "formatters": {
              "indent": {
                  "()": IndentingFormatter,
                  "format": "%(message)s",
              },
              "indent_with_timestamp": {
                  "()": IndentingFormatter,
                  "format": "%(message)s",
                  "add_timestamp": True,
              },
          },
          "handlers": {
              "console": {
                  "level": level,
                  "class": handler_classes["stream"],
                  "no_color": no_color,
                  "stream": log_streams["stdout"],
                  "filters": ["exclude_subprocess", "exclude_warnings"],
                  "formatter": "indent",
              },
              "console_errors": {
                  "level": "WARNING",
                  "class": handler_classes["stream"],
                  "no_color": no_color,
                  "stream": log_streams["stderr"],
                  "filters": ["exclude_subprocess"],
                  "formatter": "indent",
              },
              # A handler responsible for logging to the console messages
              # from the "subprocessor" logger.
              "console_subprocess": {
                  "level": level,
                  "class": handler_classes["stream"],
                  "no_color": no_color,
                  "stream": log_streams["stderr"],
                  "filters": ["restrict_to_subprocess"],
                  "formatter": "indent",
              },
              "user_log": {
                  "level": "DEBUG",
                  "class": handler_classes["file"],
                  "filename": additional_log_file,
                  "delay": True,
                  "formatter": "indent_with_timestamp",
              },
          },
          "root": {
              "level": root_level,
              "handlers": handlers,
          },
          "loggers": {
              "pip._vendor": {
                  "level": vendored_log_level
              }
          },
      })
  
      return level_number
function_tokens: def setup_logging ( verbosity , no_color , user_log_file ) : # Determine the level to be logging at. if verbosity >= 1 : level = "DEBUG" elif verbosity == - 1 : level = "WARNING" elif verbosity == - 2 : level = "ERROR" elif verbosity <= - 3 : level = "CRITICAL" else : level = "INFO" level_number = getattr ( logging , level ) # The "root" logger should match the "console" level *unless* we also need # to log to a user log file. include_user_log = user_log_file is not None if include_user_log : additional_log_file = user_log_file root_level = "DEBUG" else : additional_log_file = "/dev/null" root_level = level # Disable any logging besides WARNING unless we have DEBUG level logging # enabled for vendored libraries. vendored_log_level = "WARNING" if level in [ "INFO" , "ERROR" ] else "DEBUG" # Shorthands for clarity log_streams = { "stdout" : "ext://sys.stdout" , "stderr" : "ext://sys.stderr" , } handler_classes = { "stream" : "pip._internal.utils.logging.ColorizedStreamHandler" , "file" : "pip._internal.utils.logging.BetterRotatingFileHandler" , } handlers = [ "console" , "console_errors" , "console_subprocess" ] + ( [ "user_log" ] if include_user_log else [ ] ) logging . config . dictConfig ( { "version" : 1 , "disable_existing_loggers" : False , "filters" : { "exclude_warnings" : { "()" : "pip._internal.utils.logging.MaxLevelFilter" , "level" : logging . WARNING , } , "restrict_to_subprocess" : { "()" : "logging.Filter" , "name" : subprocess_logger . name , } , "exclude_subprocess" : { "()" : "pip._internal.utils.logging.ExcludeLoggerFilter" , "name" : subprocess_logger . name , } , } , "formatters" : { "indent" : { "()" : IndentingFormatter , "format" : "%(message)s" , } , "indent_with_timestamp" : { "()" : IndentingFormatter , "format" : "%(message)s" , "add_timestamp" : True , } , } , "handlers" : { "console" : { "level" : level , "class" : handler_classes [ "stream" ] , "no_color" : no_color , "stream" : log_streams [ "stdout" ] , "filters" : [ "exclude_subprocess" , "exclude_warnings" ] , "formatter" : "indent" , } , "console_errors" : { "level" : "WARNING" , "class" : handler_classes [ "stream" ] , "no_color" : no_color , "stream" : log_streams [ "stderr" ] , "filters" : [ "exclude_subprocess" ] , "formatter" : "indent" , } , # A handler responsible for logging to the console messages # from the "subprocessor" logger. "console_subprocess" : { "level" : level , "class" : handler_classes [ "stream" ] , "no_color" : no_color , "stream" : log_streams [ "stderr" ] , "filters" : [ "restrict_to_subprocess" ] , "formatter" : "indent" , } , "user_log" : { "level" : "DEBUG" , "class" : handler_classes [ "file" ] , "filename" : additional_log_file , "delay" : True , "formatter" : "indent_with_timestamp" , } , } , "root" : { "level" : root_level , "handlers" : handlers , } , "loggers" : { "pip._vendor" : { "level" : vendored_log_level } } , } ) return level_number