favicon 204

This commit is contained in:
Mateusz Gruszczyński
2025-10-06 09:02:34 +02:00
parent 6db9d9ccd4
commit cfdf38ce1d
3 changed files with 12 additions and 4 deletions

View File

@@ -1,5 +1,9 @@
import logging
class IgnoreHealth(logging.Filter):
def __init__(self, name: str = ""): super().__init__(name)
class IgnoreHealthAndFavicon(logging.Filter):
def __init__(self, name: str = ""):
super().__init__(name)
def filter(self, record: logging.LogRecord) -> bool:
return "/health" not in record.getMessage()
msg = record.getMessage()
return all(p not in msg for p in ["/health", "/favicon.ico"])

View File

@@ -6,5 +6,9 @@ import uvicorn
app = FastAPI(title='IP Geo API')
app.include_router(router)
@app.get("/favicon.ico")
async def favicon():
return Response(status_code=204)
if __name__ == '__main__':
uvicorn.run('app.main:app', host=settings.host, port=settings.port, log_level=settings.log_level)