INNER CODE UNIT · Python
access_log_middleware
BlessedRebuS/Krawl · src/app.py:303
async def access_log_middleware(request: Request, call_next):
from dependencies import get_client_ip
response: Response = await call_next(request)
# Banned requests are already logged by BanCheckMiddleware
if getattr(request.state, "banned", False):
return response
path = request.url.path
# Don't log health probes — they fire every few seconds and add noise.
# The probe path is derived from the (possibly auto-generated) secret.
config = request.app.state.config
health_path = "/" + config.dashboard_secret_path.lstrip("/") + "/healthz"
if path == health_path:
return response