Skip to content

epeters-jrmngndr/fastapi-route-logger

 
 

Repository files navigation

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.

The sample-site in the code repository contains a sample FastAPI site with this middleware integrated.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 97.6%
  • Shell 2.4%