SpeedBeaver - Structlog Integration for FastAPI
When asked what their favourite part of a new project is, I can guarantee you very few developers will say this: setting up logging.
Thing is, logs are crucial for both security and development, giving you detailed insights as to what's going on at any given point with an application. They just . . . really suck to set up.
SpeedBeaver was built to have a simple, approachable, set-it-and-forget-it way of setting up logging middleware in FastAPI using structlog. It's designed as an alternative to the existing fastapi-structlog.
Current Status
The integration is currently in a pre-alpha state. API is subject to change, as is the name of the library itself, even.
Features
- 3-4 lines of config for the basics
- Optional BYOP (Bring Your Own Processors)
- Environment variable configuration via Pydantic Settings
- File logging
Planned Features and Items
- OpenTelemetry integrations
- Database integrations
- Documentation
Installation
[!CAUTION] SpeedBeaver is NOT yet on PyPI! The below command(s) will not work until this README is updated and the project is fully released.
pip install speedbeaver
Configuration
To drop SpeedBeaver into any FastAPI app, see the following Python snippet:
from fastapi import FastAPI
import speedbeaver
app = FastAPI()
speedbeaver.quick_configure(app)
# Try using the line below instead to see the difference!
# speedbeaver.quick_configure(app, log_level="DEBUG")
logger = speedbeaver.get_logger()
@app.get("/")
async def index():
await logger.debug("I'm a debug message!")
await logger.info("Hello, world!")
return {"message": "Hello, world!"}
Release files for speedbeaver 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| speedbeaver-0.2.1.tar.gz | 34.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| speedbeaver-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 43.6 kB
Release files / speedbeaver-0.2.1.tar.gz
| Download URL | speedbeaver-0.2.1.tar.gz |
|---|---|
| Size | 34.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a3c471d01c907d56d6d866fa938c23388481740e0169ae708208d0e09adca02c
|
|
BLAKE2b-256 checksum How to use checksums |
f66f705bd2890a206aa414df53a71964742b12293234b3201df2a4c2d5d2f6f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.7.15
|
Release files / speedbeaver-0.2.1-py3-none-any.whl
| Download URL | speedbeaver-0.2.1-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
75c8bc14901033dc1703cdb662e1976d3d4da2a178fb03daa8f7dce22b5807f0
|
|
BLAKE2b-256 checksum How to use checksums |
1faf0b8e10b1da336edde101bd320e1190f150df7532ce673c11e3c2f8588f72
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.7.15
|