Skip to content

Commit

Permalink
Merge pull request #155 from girder/record-type
Browse files Browse the repository at this point in the history
  • Loading branch information
brianhelba authored Oct 6, 2021
2 parents d18cf46 + 442e856 commit 4ac12eb
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions composed_configuration/_logging.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import logging
from typing import Optional

from django.http import HttpRequest

from ._base import ConfigMixin


def _filter_favicon_requests(record):
if (
record.name == 'django.request'
and hasattr(record, 'request')
and record.request.path == '/favicon.ico'
):
return False
def _filter_favicon_requests(record: logging.LogRecord) -> bool:
if record.name == 'django.request':
request: Optional[HttpRequest] = getattr(record, 'request', None)
if request and request.path == '/favicon.ico':
return False

if (
record.name == 'django.server'
and isinstance(record.args, tuple)
and len(record.args) >= 1
and str(record.args[0]).startswith('GET /favicon.ico ')
):
Expand All @@ -19,9 +23,10 @@ def _filter_favicon_requests(record):
return True


def _filter_static_requests(record):
def _filter_static_requests(record: logging.LogRecord) -> bool:
if (
record.name == 'django.server'
and isinstance(record.args, tuple)
and len(record.args) >= 1
and str(record.args[0]).startswith('GET /static/')
):
Expand Down

0 comments on commit 4ac12eb

Please sign in to comment.