uvicorn icon indicating copy to clipboard operation
uvicorn copied to clipboard

Enabled to pass log_config as ConfigParser instance or a file object

Open antonymayi opened this issue 2 years ago • 0 comments

This is a new instance of PR #1716 closed accidentally by deleting the forked repository.

Copy of the previous description:

The existing logic for the log_config option accepts:

  • dict or str representing a JSON or YAML file name to be parsed using logging.config.dictConfig
  • str representing an INI file name to be parsed using logging.config.fileConfig

The logging.config.fileConfig, however, accepts not only the file name, but possibly also an instance of configparser.RawConfigParser and even an open file object. Passing the instance of configparser.RawConfigParser (or its subclass) would be especially useful as this can accumulate configs from multiple files (cp.read() can be called repeatedly on different files updating its config values) instead of just a single one.

I am proposing this trivial change to allow the log_config option to also accept the *ConfigParser instance or a general file object.

antonymayi avatar May 13 '23 20:05 antonymayi