Skip to main content

SIFT dev-logger (v2.0)

A lightweight Python logging SDK that provides structured logging for Flask and FastAPI applications. This new version uses a custom implementation without OpenTelemetry dependencies.


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 optional dependencies:

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

Features

  • Simple structured logging without dependencies on OpenTelemetry
  • Batching of logs for better performance
  • Customizable configuration through environment variables or code
  • Support for Flask and FastAPI web frameworks
  • Ability to send logs to a custom endpoint or fallback to console output

Configuration

Configure the logger via environment variables:

# Required for sending logs to a custom endpoint
export SIFT_DEV_ENDPOINT="https://your-log-endpoint.com/logs"
export SIFT_DEV_API_KEY="your-api-key"

# Optional configuration
export SIFT_DEV_SERVICE_NAME="your-service-name"
export SIFT_DEV_SERVICE_INSTANCE_ID="your-instance-id"
export ENV="production"  # or development, staging, etc.

Or configure programmatically:

from sift_dev_logger import configure, SiftDevConfig

# Configure once at application startup
configure(SiftDevConfig(
    service_name="my-service",
    service_instance_id="instance-1",
    endpoint="https://your-log-endpoint.com/logs",
    api_key="your-api-key",
    env="production",
    batch_size=10,  # Number of logs to batch before sending
    batch_delay_millis=5000  # Maximum time to wait before sending a batch
))

Basic Usage

from sift_dev_logger import getLogger

# Get a logger (automatically configured with SiftDevHandler)
logger = getLogger("my_module")

# Log messages with different severity levels
logger.info("This is an informational message")
logger.warning("This is a warning message")
logger.error("This is an error message")

# Log with additional context
logger.info("User logged in", extra={"user_id": "12345", "ip_address": "192.168.1.1"})

# Log with structured data
logger.info("API request completed", extra={
    "request_id": "req-abc-123",
    "duration_ms": 42,
    "status_code": 200,
    "user": {
        "id": "user-123",
        "role": "admin"
    }
})

# Make sure all logs are flushed before application exit
from sift_dev_logger import flush_logs
flush_logs()

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.

Metadata

Release files for sift-dev-logger 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sift-dev-logger 2.0.1
File Size Uploaded Provenance Actions
sift_dev_logger-2.0.1.tar.gz 18.7 kB Without provenance Details for sift_dev_logger-2.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sift-dev-logger 2.0.1
File Interpreter ABI Platform Actions
sift_dev_logger-2.0.1-py2.py3-none-any.whl Python 2, Python 3 none any Details for sift_dev_logger-2.0.1-py2.py3-none-any.whl

Total release size: 31.6 kB

Release files / sift_dev_logger-2.0.1.tar.gz

Download URL sift_dev_logger-2.0.1.tar.gz
Size 18.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6b775e5a68c1e593ec036a7f5ca56a0fc6500b32f240fce5e14a001db1fd7b2c
BLAKE2b-256 checksum
How to use checksums
02079de05ee7aafb09bf83d48ffbaad98acf3b21d4ecadf338d2c72f9809d1d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release files / sift_dev_logger-2.0.1-py2.py3-none-any.whl

Download URL sift_dev_logger-2.0.1-py2.py3-none-any.whl
Size 12.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
1cca633cc1d57a033e2f8f5abed000e79de7bbf58077f5bbbb8968c0ae8ab15a
BLAKE2b-256 checksum
How to use checksums
31813b1b3f250c44ca818d91970cabdc9c810c16b414fc130c4e21e9ab1dbd01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Security for sift-dev-logger 2.0.1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page