From 28c9c2bb266354ce47d42ac7557ec4b5be52e83b Mon Sep 17 00:00:00 2001 From: Sebastian Tobie Date: Sun, 10 Mar 2024 00:30:35 +0100 Subject: [PATCH] a bit better formatting --- .../src/gunicorn_logging_extension/__init__.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/gunicorn-logging-extension/src/gunicorn_logging_extension/__init__.py b/gunicorn-logging-extension/src/gunicorn_logging_extension/__init__.py index 8561a40..64dfab5 100644 --- a/gunicorn-logging-extension/src/gunicorn_logging_extension/__init__.py +++ b/gunicorn-logging-extension/src/gunicorn_logging_extension/__init__.py @@ -20,7 +20,11 @@ CONFIG_DEFAULTS = { "root": {"level": "INFO", "handlers": ["console"]}, "loggers": {}, "handlers": { - "console": {"class": "logging.StreamHandler", "formatter": "generic", "stream": "ext://sys.stdout"}, + "console": { + "class": "logging.StreamHandler", + "formatter": "generic", + "stream": "ext://sys.stdout", + }, }, "formatters": { "generic": { @@ -70,7 +74,9 @@ class Logger(gLogger): defaults = CONFIG_DEFAULTS.copy() defaults["__file__"] = cfg.logconfig defaults["here"] = os.path.dirname(cfg.logconfig) - fileConfig(cfg.logconfig, defaults=defaults, disable_existing_loggers=False) + fileConfig( + cfg.logconfig, defaults=defaults, disable_existing_loggers=False + ) else: msg = "Error: log config '%s' not found" raise RuntimeError(msg % cfg.logconfig) @@ -84,10 +90,9 @@ class Logger(gLogger): level = self.access_log.warning elif resp.status_code >= 500: level = self.access_log.error - # wrap atoms: - # - make sure atoms will be test case insensitively - # - if atom doesn't exist replace it by '-' - safe_atoms = self.atoms_wrapper_class(self.atoms(resp, req, environ, request_time)) + safe_atoms = self.atoms_wrapper_class( + self.atoms(resp, req, environ, request_time) + ) extra = dict( METHOD=environ.get("REQUEST_METHOD"), PATH=environ.get("PATH_INFO"),