mirror of
https://github.com/zulip/zulip.git
synced 2025-11-13 18:36:36 +00:00
logging: Use django.server to filter 200 and 304.
Previously, we were monkey patching the runserver command in zerver/management/commands/rundjango.py for this.
This commit is contained in:
@@ -61,3 +61,13 @@ class RequireReallyDeployed(logging.Filter):
|
||||
# type: (logging.LogRecord) -> bool
|
||||
from django.conf import settings
|
||||
return settings.PRODUCTION
|
||||
|
||||
def skip_200_and_304(record):
|
||||
# type: (logging.LogRecord) -> bool
|
||||
# Apparently, `status_code` is added by Django and is not an actual
|
||||
# attribute of LogRecord; as a result, mypy throws an error if we
|
||||
# access the `status_code` attribute directly.
|
||||
if getattr(record, 'status_code') in [200, 304]:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user