Skip to content

Commit

Permalink
EndpointFilter added
Browse files Browse the repository at this point in the history
  • Loading branch information
sureshhewabi committed Mar 14, 2024
1 parent baf4fa8 commit 22a1fbf
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/routes/xiview.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,18 @@

xiview_data_router = APIRouter()


class EndpointFilter(logging.Filter):
"""
Define the filter to stop logging for visualisation endpoint which will be called very frequently
and log file will be flooded with this endpoint request logs
"""
def filter(self, record: logging.LogRecord) -> bool:
return record.args and len(record.args) >= 3 and not str(record.args[2]).__contains__("/data/visualisations/")


logger = logging.getLogger(__name__)
logging.getLogger("uvicorn.access").addFilter(EndpointFilter())


@xiview_data_router.get('/get_xiview_data', tags=["xiVIEW"])
Expand Down

0 comments on commit 22a1fbf

Please sign in to comment.