Setting up logging for FastAPI should not take up the bulk of your time.
Project description
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!"}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file speedbeaver-0.2.1.tar.gz.
File metadata
- Download URL: speedbeaver-0.2.1.tar.gz
- Upload date:
- Size: 34.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.7.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3c471d01c907d56d6d866fa938c23388481740e0169ae708208d0e09adca02c
|
|
| MD5 |
2b2655975efb50095bd5514d03d0a63c
|
|
| BLAKE2b-256 |
f66f705bd2890a206aa414df53a71964742b12293234b3201df2a4c2d5d2f6f1
|
File details
Details for the file speedbeaver-0.2.1-py3-none-any.whl.
File metadata
- Download URL: speedbeaver-0.2.1-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.7.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75c8bc14901033dc1703cdb662e1976d3d4da2a178fb03daa8f7dce22b5807f0
|
|
| MD5 |
0b7afaa639573ea0c043afd9f3ada8fd
|
|
| BLAKE2b-256 |
1faf0b8e10b1da336edde101bd320e1190f150df7532ce673c11e3c2f8588f72
|