Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fastapi-route-logger-middleware

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastapi-route-logger-middleware

Simple middleware for FastAPI to generate log entries on all requests

  • 0.2.3
  • PyPI
  • Socket score

Maintainers
1

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.

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc