2015-12-06 19:53:17 +01:00
|
|
|
# Wrapper around Django's runserver to allow filtering logs.
|
|
|
|
|
2016-06-04 16:52:18 +02:00
|
|
|
from typing import Any
|
|
|
|
|
2015-12-06 19:53:17 +01:00
|
|
|
from django.core.servers.basehttp import WSGIRequestHandler
|
|
|
|
orig_log_message = WSGIRequestHandler.log_message
|
|
|
|
def log_message_monkey(self, format, *args):
|
2016-06-04 16:52:18 +02:00
|
|
|
# type: (Any, str, *Any) -> None
|
2015-12-06 19:53:17 +01:00
|
|
|
# Filter output for 200 or 304 responses.
|
|
|
|
if args[1] == '200' or args[1] == '304':
|
|
|
|
return
|
2016-01-27 21:49:19 +01:00
|
|
|
orig_log_message(self, format, *args)
|
2015-12-06 19:53:17 +01:00
|
|
|
|
|
|
|
WSGIRequestHandler.log_message = log_message_monkey
|
|
|
|
|
|
|
|
from django.core.management.commands.runserver import Command
|