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="/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.1.tar.gz
(2.7 kB
view details)
Built Distribution
File details
Details for the file endpoint_filter-0.1.1.tar.gz
.
File metadata
- Download URL: endpoint_filter-0.1.1.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 | 96a1484d93d07cff896018928bda14097ee81a2c8fe777ec315dc1b421b94279 |
|
MD5 | c62a45cb843e88a00c02510e1f2456f7 |
|
BLAKE2b-256 | d1e55e19e765bd6c0c28ec2964198490c2baab7cd1e88dcc51c43176a90be081 |
File details
Details for the file endpoint_filter-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: endpoint_filter-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.2 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 | b749469f8889726af1a31355299bc6b1596f43cc0cbb551a860e351eea58129c |
|
MD5 | 2b8fed3b1049835594d4b0b9eb5b30c7 |
|
BLAKE2b-256 | fa9273003d7fa79ee06407377cc533d5ddb965fa27c39b5390dd4b50bd2887b9 |