An endpoint filter for the standard library logging module.
Project description
Endpoint filter for the standard librarys logging module.
This package provides a filter for the standard librarys logging module that filters out log messages based on the request path of a FastAPI application.
Usage
from fastapi import FastAPI
import logging
from endpoint_filter import EndpointFilter
app = FastAPI()
uvicorn_logger = logging.getLogger("uvicorn.access")
uvicorn_logger.addFilter(EndpointFilter(path="/live"))
uvicorn_logger.addFilter(EndpointFilter(path="/live", verb="POST"))
uvicorn_logger.addFilter(EndpointFilter(path="/endpoint"))
@app.get('/endpoint') # This endpoint will be ignored by the filter
async def endpoint():
return {"message": "Hello endpoint"}
@app.get('/live') # This endpoint will be ignored by the filter
async def live():
return {"message": "Hello live"}
@app.get('/')
async def root():
return {"message": "Hello root"}
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
endpoint_filter-0.1.2.tar.gz
(2.7 kB
view details)
Built Distribution
File details
Details for the file endpoint_filter-0.1.2.tar.gz
.
File metadata
- Download URL: endpoint_filter-0.1.2.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.3 Windows/11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85b07f1e0fa1e640452a87dbf3ae8ab5a3d5bb99a4dbfc91449652e0bf4700ad |
|
MD5 | cfb891c169d29522b657a21583c28f6f |
|
BLAKE2b-256 | 825a472b117f8faa34709354dded78ffb83827a03bd2b508a0f3151775b4a56e |
File details
Details for the file endpoint_filter-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: endpoint_filter-0.1.2-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.3 Windows/11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e66c33c683165ea71685977824cd3547b63297e5953c5727913d24d80376120b |
|
MD5 | 6f736e625037dc07bf8526f12fcd11f2 |
|
BLAKE2b-256 | 3e66ccaa33377647ad35ff2df9a59c98cdabe64c09c827e26d529e0beea8d102 |