A logging SDK for Sift Dev that supports Flask and FastAPI
Project description
SIFT dev-logger
A Python logging SDK that provides structured logging for Flask and FastAPI applications.
Installation
Using pip
pip install sift-dev-logger
With optional Flask support:
pip install "sift-dev-logger[flask]"
With optional FastAPI support:
pip install "sift-dev-logger[fastapi]"
Usage
Flask Application
from flask import Flask
from sift_dev_logger.config import SiftDevConfig, configure
from sift_dev_logger.flask import instrument_logging_middleware
app = Flask(__name__)
# Configure the SDK
config = SiftDevConfig(
service_name="my-flask-app",
service_instance="my-instance",
sift_dev_logging_project_key="my-project-key"
)
configure(config)
# Add logging middleware
instrument_logging_middleware(app)
FastAPI Application
from fastapi import FastAPI
from sift_dev_logger.config import SiftDevConfig, configure
from sift_dev_logger.fastapi import instrument_logging_middleware
app = FastAPI()
# Configure the SDK
config = SiftDevConfig(
service_name="my-fastapi-app",
service_instance="my-instance",
sift_dev_logging_project_key="my-project-key"
)
configure(config)
# Add logging middleware
instrument_logging_middleware(app)
How to build and publish
-
Install build tools:
pip install build
-
Build the package:
python -m build
-
Test the package locally:
pip install sift_dev_logger-0.1.0.tar.gz
-
Upload to PyPI (you’ll need to create an account first):
python -m twine upload dist/*
Key Features
- Optional Dependencies: Users can install just what they need (core, Flask, or FastAPI support).
- Modern Build System: Uses
hatchlingfor a clean, modern build. - Clear Documentation: README shows installation and basic usage.
- Version Management: Easy to update version in one place.
- Development Tooling: Development dependencies separated from runtime requirements.
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 sift_dev_logger-1.0.5.tar.gz.
File metadata
- Download URL: sift_dev_logger-1.0.5.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d96eafe13ae1f5d80c697d590a731ac589376f4b74818e66b305256c62cdb2a
|
|
| MD5 |
98c0fe03b8652ed5f767e02b6debb55f
|
|
| BLAKE2b-256 |
ba52bbf300af6ef89ea1ba278b298ae6e5527abca1bc2b30bdd7250448b78b8c
|
File details
Details for the file sift_dev_logger-1.0.5-py2.py3-none-any.whl.
File metadata
- Download URL: sift_dev_logger-1.0.5-py2.py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f106f5a37e8943f65fdadc76069bfaafc0953f3aa59417b741677750571b68a
|
|
| MD5 |
14ce241c693bc1941d42c846119fee13
|
|
| BLAKE2b-256 |
d3464419d3ffdf5f91adad0c3da59e1123a7b99d09da5ea42cb09b233db417e8
|