Skip to main content

fastapi-route-logger

Basic middleware to log requests made to routes in FastAPI applications.

Installation

pip install fastapi-route-logger-middleware

Usage

The component is FastAPI middleware.

app.add_middleware(RouteLoggerMiddleware)

Additional arguments can be provided, when needed:

  • logger - The Logger instance to use. Defaults to the default logger (logging.getLogger(__name__)).
  • skip_routes - A list of strings that represent the start of routes that should not be logged. Default is an empty list. This is a "begins with" type match so an entry of "/health" will block the routes /health/check and /healthcheck.
  • skip_regexes - A list of regex strings that will be matched against routes that should not be logged. Default is an empty list. This uses compiled regexes and matches against the entire path. An entry of ".*/health" will not log the routes /health and /api/1.0/health.

The sample-site in the code repository contains a sample FastAPI site with this middleware integrated. Check the included readme for more information.

Metadata

Release files for fastapi-route-logger-middleware 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for fastapi-route-logger-middleware 0.2.3
File Interpreter ABI Platform
fastapi_route_logger_middleware-0.2.3-py3-none-any.whl Python 3 none any Details

Release files / fastapi_route_logger_middleware-0.2.3-py3-none-any.whl

Download URL fastapi_route_logger_middleware-0.2.3-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d6d4db9db5156cd7842e22070398f0c98f91bd2ad7340c1ec74c2bff0f72637f
BLAKE2b-256 checksum
How to use checksums
59354b2a100fb399107bf456abc7c11b3edab4aec001c14b752f27310fefce61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

Release history Release notifications | RSS feed

This release

0.2.3 This release

1 release file

0.1.4

1 release file

0.1.3

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page