an fixed version of the logger

the logs are now retrieved after they are initialized
Dieser Commit ist enthalten in:
Sebastian Tobie 2024-03-05 21:03:32 +01:00
Ursprung 21dc03b139
Commit e4386193ad
1 geänderte Dateien mit 22 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -10,17 +10,36 @@ from logging.config import dictConfig, fileConfig
from gunicorn.glogging import CONFIG_DEFAULTS
from gunicorn.glogging import Logger as gLogger
__version__ = "0.0.3"
__version__ = "0.0.5"
CONFIG_DEFAULTS = {
"version": 1,
"disable_existing_loggers": False,
"root": {"level": "INFO", "handlers": ["console"]},
"loggers": {},
"handlers": {
"console": {"class": "logging.StreamHandler", "formatter": "generic", "stream": "ext://sys.stdout"},
},
"formatters": {
"generic": {
"format": "%(asctime)s [%(process)d] [%(levelname)s] %(message)s",
"datefmt": "[%Y-%m-%d %H:%M:%S %z]",
"class": "logging.Formatter",
}
},
}
class Logger(gLogger):
def __init__(self, cfg):
self.error_log = logging.getLogger("gunicorn.error")
self.access_log = logging.getLogger("gunicorn.access")
self.logfile = None
self.lock = threading.Lock()
self.cfg = cfg
self.setup(cfg)
self.error_log = logging.getLogger("gunicorn.error")
self.access_log = logging.getLogger("gunicorn.access")
def setup(self, cfg):
if cfg.logconfig_dict:
@ -60,15 +79,6 @@ class Logger(gLogger):
for format details
"""
if not (
self.cfg.accesslog
or self.cfg.logconfig
or self.cfg.logconfig_dict
or self.cfg.logconfig_json
or (self.cfg.syslog and not self.cfg.disable_redirect_access_to_syslog)
):
return
# wrap atoms:
# - make sure atoms will be test case insensitively
# - if atom doesn't exist replace it by '-'