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.3.tar.gz
(2.7 kB
view details)
Built Distribution
File details
Details for the file endpoint_filter-0.1.3.tar.gz
.
File metadata
- Download URL: endpoint_filter-0.1.3.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 | 3085e4eaae6da4e296e31424f0a00cc9897ac70c9b7357e10e9e91c2312586e7 |
|
MD5 | efb680bf6fc980b41cf03bd0c1515bea |
|
BLAKE2b-256 | 419b7c202b4ae6e08ec4f6bd2e8d4ce7819e4d759c4a0c691ccdb6e8ddf2f3c0 |
File details
Details for the file endpoint_filter-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: endpoint_filter-0.1.3-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 | 1b81eb7cfcdcd56e645ac649d14cb0ba5f756e640ea4e61fc62aaeb7d6b6c988 |
|
MD5 | f1ce825f1c2d31ab0b93c483692fda3a |
|
BLAKE2b-256 | c50ca88195609f4726a28ad98426f5fe0c02f4d101a96583243da3ad21a484ab |