This release is a pre-release and may not be stable for production use.
Swarmauri Middleware Logging
HTTP middleware for logging requests and responses in Swarmauri and FastAPI applications.
Features
- Logs the HTTP method and path for each incoming request.
- Captures request headers and attempts to parse JSON bodies for inspection.
- Emits a warning when the request body cannot be decoded as JSON.
- Measures total processing time and records the response status code.
Installation
Install the package with your preferred Python packaging tool:
pip install swarmauri_middleware_logging
poetry add swarmauri_middleware_logging
uv pip install swarmauri_middleware_logging
uv add swarmauri_middleware_logging
Example
from fastapi import FastAPI, Request
from fastapi.testclient import TestClient
from swarmauri_middleware_logging import LoggingMiddleware
app = FastAPI()
logging_middleware = LoggingMiddleware()
@app.middleware("http")
async def log_requests(request: Request, call_next):
return await logging_middleware.dispatch(request, call_next)
@app.post("/echo")
async def echo(payload: dict):
return payload
client = TestClient(app)
print(client.post("/echo", json={"message": "hello"}).json())
Running the example prints the echoed payload and produces INFO-level log entries for the request and response lifecycle.
Want to help?
If you want to contribute to swarmauri-sdk, read up on our guidelines for contributing that will help you get started.
Metadata
Release files for swarmauri_middleware_logging 0.11.0.dev1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| swarmauri_middleware_logging-0.11.0.dev1.tar.gz | 7.4 kB | Without provenance | Details for swarmauri_middleware_logging-0.11.0.dev1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| swarmauri_middleware_logging-0.11.0.dev1-py3-none-any.whl | Python 3 | none | any | Details for swarmauri_middleware_logging-0.11.0.dev1-py3-none-any.whl |
Total release size: 15.8 kB
Release files / swarmauri_middleware_logging-0.11.0.dev1.tar.gz
| Download URL | swarmauri_middleware_logging-0.11.0.dev1.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
41554f15f8c3f140d5669c3c560eb0e8ee424b63ab139fcb4f4c5b17206ba719
|
|
BLAKE2b-256 checksum How to use checksums |
2544f90fbc2035e5d6a43767c08b7b4c900376ed21da0feb2b1cdbd055b51e44
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / swarmauri_middleware_logging-0.11.0.dev1-py3-none-any.whl
| Download URL | swarmauri_middleware_logging-0.11.0.dev1-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
884692432c47d6674c83e10044725538e9c3d162d81fda0bc06d074fdeeaed87
|
|
BLAKE2b-256 checksum How to use checksums |
ff053a05bb151e61de874ccae8c6b647d280269f4079dd987c680f14f0ff36f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for swarmauri_middleware_logging 0.11.0.dev1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.