From fb739f93fc0f75eaa7654c4f8a54625a55cfb770 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 25 Aug 2022 23:15:27 +0100 Subject: [PATCH] Add basic logging config --- website/settings.py | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/website/settings.py b/website/settings.py index dff4795..5bef242 100644 --- a/website/settings.py +++ b/website/settings.py @@ -231,6 +231,47 @@ REST_FRAMEWORK = { ], } +LOGGING = { + "version": 1, + "disable_existing_loggers": False, + "handlers": { + # Send logs with at least INFO level to the console. + "console": { + "level": "INFO", + "class": "logging.StreamHandler", + "formatter": "verbose", + }, + }, + "formatters": { + "verbose": { + "format": "[%(asctime)s][%(process)d][%(levelname)s][%(name)s] %(message)s" + } + }, + "loggers": { + "website": { + "handlers": ["console"], + "level": "INFO", + "propagate": False, + }, + "wagtail": { + "handlers": ["console"], + "level": "WARNING", + "propagate": False, + }, + "django.request": { + "handlers": ["console"], + "level": "ERROR", + "propagate": False, + }, + "django.security": { + "handlers": ["console"], + "level": "WARNING", + "propagate": False, + }, + }, +} + + SECURE_BROWSER_XSS_FILTER = True SECURE_CONTENT_TYPE_NOSNIFF = True X_FRAME_OPTIONS = "DENY"