a bit better formatting

Dieser Commit ist enthalten in:
Sebastian Tobie 2024-03-10 00:30:35 +01:00
Ursprung 3d350413cd
Commit 28c9c2bb26
1 geänderte Dateien mit 11 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -20,7 +20,11 @@ CONFIG_DEFAULTS = {
"root": {"level": "INFO", "handlers": ["console"]}, "root": {"level": "INFO", "handlers": ["console"]},
"loggers": {}, "loggers": {},
"handlers": { "handlers": {
"console": {"class": "logging.StreamHandler", "formatter": "generic", "stream": "ext://sys.stdout"}, "console": {
"class": "logging.StreamHandler",
"formatter": "generic",
"stream": "ext://sys.stdout",
},
}, },
"formatters": { "formatters": {
"generic": { "generic": {
@ -70,7 +74,9 @@ class Logger(gLogger):
defaults = CONFIG_DEFAULTS.copy() defaults = CONFIG_DEFAULTS.copy()
defaults["__file__"] = cfg.logconfig defaults["__file__"] = cfg.logconfig
defaults["here"] = os.path.dirname(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: else:
msg = "Error: log config '%s' not found" msg = "Error: log config '%s' not found"
raise RuntimeError(msg % cfg.logconfig) raise RuntimeError(msg % cfg.logconfig)
@ -84,10 +90,9 @@ class Logger(gLogger):
level = self.access_log.warning level = self.access_log.warning
elif resp.status_code >= 500: elif resp.status_code >= 500:
level = self.access_log.error level = self.access_log.error
# wrap atoms: safe_atoms = self.atoms_wrapper_class(
# - make sure atoms will be test case insensitively self.atoms(resp, req, environ, request_time)
# - if atom doesn't exist replace it by '-' )
safe_atoms = self.atoms_wrapper_class(self.atoms(resp, req, environ, request_time))
extra = dict( extra = dict(
METHOD=environ.get("REQUEST_METHOD"), METHOD=environ.get("REQUEST_METHOD"),
PATH=environ.get("PATH_INFO"), PATH=environ.get("PATH_INFO"),