From 3e7d9ae7ec34156a5297cd5a543f99b72011105e Mon Sep 17 00:00:00 2001 From: MaM Web user Date: Mon, 6 Sep 2021 14:13:37 +0200 Subject: [PATCH] =?UTF-8?q?Zapomenut=C3=BD=20filtr?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- various/log_filters.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 various/log_filters.py diff --git a/various/log_filters.py b/various/log_filters.py new file mode 100644 index 00000000..c69c0bae --- /dev/null +++ b/various/log_filters.py @@ -0,0 +1,6 @@ +from logging import Filter, INFO +class Http404AsInfoFilter(Filter): + def filter(self, record): + if record.name == 'django.request' and record.status_code == 404: + record.levelno = INFO + return 1 # Keep the log record