Skip to main content

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]"

With all library support:

pip install "sift-dev-logger[all]"

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

  1. Install build tools:

    pip install build
    
  2. Build the package:

    python -m build
    
  3. Test the package locally:

    pip install sift_dev_logger-0.1.0.tar.gz
    
  4. Upload to PyPI (you’ll need to create an account first):

    python -m twine upload dist/*
    

Key Features

  1. Optional Dependencies: Users can install just what they need (core, Flask, or FastAPI support).
  2. Modern Build System: Uses hatchling for a clean, modern build.
  3. Clear Documentation: README shows installation and basic usage.
  4. Version Management: Easy to update version in one place.
  5. Development Tooling: Development dependencies separated from runtime requirements.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sift_dev_logger-1.0.8.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sift_dev_logger-1.0.8-py2.py3-none-any.whl (11.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file sift_dev_logger-1.0.8.tar.gz.

File metadata

  • Download URL: sift_dev_logger-1.0.8.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for sift_dev_logger-1.0.8.tar.gz
Algorithm Hash digest
SHA256 b538b918676a130e3e58ded7199d4e50d6a2318e3e5181cc6e2df9c4d6021dfb
MD5 715ab770104f68e7ca6186878ac8c5b6
BLAKE2b-256 453c565dd73f57ee6cd8512f0d5feef5b60d10094dfffad167737557817b8c2c

See more details on using hashes here.

File details

Details for the file sift_dev_logger-1.0.8-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for sift_dev_logger-1.0.8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bb40bb89b2515d6ef3ade8857249847acb0c74a710735670dfc0d8443575495d
MD5 ab3f7c14ceef3c48e45f4304a08405e2
BLAKE2b-256 e34314d3fb1d91ef37c65faaa35fe438f4b3a62f700bac1a18e1b6e6958bb6a1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page