Skip to main content

luminalog-sdk

Privacy-first logging with AI-powered debugging for Python

PyPI version Python Versions License: MIT

Installation • Quick Start • Documentation • Examples • Support


Features

  • 🔒 Privacy-First - Automatic PII scrubbing on the server
  • ⚡ Zero Performance Impact - Async batching (100 logs or 5s intervals)
  • 🛡️ Graceful Degradation - Queues logs locally if API is unavailable
  • 📦 Type Hints - Full type annotations for Python 3.8+
  • 🪶 Minimal Dependencies - Only requires requests
  • 🎯 Error Tracking - Automatic error grouping and stack traces
  • 🔄 Thread-Safe - Safe for multi-threaded applications
  • 📊 Quota Management - Built-in quota exceeded handling

Installation

pip install luminalog-sdk
poetry add luminalog-sdk
pipenv install luminalog-sdk

Example App

A runnable local example lives in examples/basic.

Quick Start

from luminalog import LuminaLog
import os

logger = LuminaLog(
    api_key=os.getenv("LUMINALOG_API_KEY"),
    environment="production"
)

# Basic logging
logger.info("User logged in", {"user_id": "123"})
logger.warn("High memory usage", {"memory_mb": 512})
logger.error("Payment failed", {"error": "Card declined"})

# Critical errors (sent immediately, bypasses batching)
logger.panic("Database connection lost!")

# Graceful shutdown
logger.shutdown()

Configuration

Options

logger = LuminaLog(
    # Required
    api_key: str,              # Your LuminaLog API key

    # Optional
    environment: str = "default",     # Environment name (default: 'default')
    project_id: str = None,           # Project identifier
    batch_size: int = 100,            # Logs before auto-flush (default: 100)
    flush_interval: float = 5.0,      # Seconds between flushes (default: 5.0)
    endpoint: str = None,             # Custom API endpoint
    debug: bool = False,              # Enable debug logging (default: False)
)

Environment Variables

Store your API key securely using environment variables:

# .env
LUMINALOG_API_KEY=your-api-key-here
import os
from luminalog import LuminaLog

logger = LuminaLog(
    api_key=os.getenv("LUMINALOG_API_KEY"),
    environment=os.getenv("ENVIRONMENT", "development")
)

API Reference

Log Levels

Level Method Description Behavior
debug logger.debug() Detailed debugging information Batched
info logger.info() General operational messages Batched
warn logger.warn() Warning conditions Batched
error logger.error() Error conditions Batched
fatal logger.fatal() Fatal errors Batched
panic logger.panic() Critical errors Immediate flush

Methods

logger.debug(message, metadata=None)

Log a debug message.

logger.info(message, metadata=None)

Log an informational message.

logger.warn(message, metadata=None)

Log a warning message.

logger.error(message, metadata=None)

Log an error message.

logger.fatal(message, metadata=None)

Log a fatal error.

logger.panic(message, metadata=None)

Log a critical error and flush immediately.

logger.capture_error(error, context=None)

Capture an exception with full stack trace.

try:
    risky_operation()
except Exception as e:
    logger.capture_error(e, {
        "user_id": "123",
        "operation": "payment_processing"
    })

Distributed Tracing Correlation

Manage trace and span identifiers for distributed system grouping.

generate_trace_id()

Generates a unique Trace ID (UUID v4) string.

generate_span_id()

Generates a unique Span ID string.

get_trace_id_from_request(request)

Extracts Trace ID from standard headers (x-trace-id, x-request-id, or W3C traceparent). Works with Flask, FastAPI, and Django requests.

from luminalog import generate_trace_id, get_trace_id_from_request

trace_id = get_trace_id_from_request(flask_request)

Examples

Flask

from flask import Flask, request
from luminalog import LuminaLog
import os

app = Flask(__name__)
logger = LuminaLog(api_key=os.getenv("LUMINALOG_API_KEY"))

@app.before_request
def log_request():
    logger.info(f"{request.method} {request.path}", {
        "ip": request.remote_addr,
        "user_agent": request.user_agent.string
    })

@app.errorhandler(Exception)
def handle_error(error):
    logger.capture_error(error, {
        "path": request.path,
        "method": request.method
    })
    return "Internal Server Error", 500

if __name__ == "__main__":
    try:
        app.run()
    finally:
        logger.shutdown()

FastAPI

from fastapi import FastAPI, Request
from luminalog import LuminaLog
import os

app = FastAPI()
logger = LuminaLog(api_key=os.getenv("LUMINALOG_API_KEY"))

@app.middleware("http")
async def log_requests(request: Request, call_next):
    logger.info(f"{request.method} {request.url.path}", {
        "client": request.client.host,
        "user_agent": request.headers.get("user-agent")
    })
    response = await call_next(request)
    return response

@app.on_event("shutdown")
async def shutdown_event():
    logger.shutdown()

AWS Lambda

from luminalog import LuminaLog
import os

logger = LuminaLog(api_key=os.getenv("LUMINALOG_API_KEY"))

def lambda_handler(event, context):
    try:
        logger.info("Lambda invoked", {"event_type": event.get("type")})
        # Logic...
    except Exception as e:
        logger.capture_error(e, {"event": event})
        raise
    finally:
        logger.shutdown()

Documentation

Support

Contributing

We welcome contributions! Please see our Contributing Guide for details.

License

MIT © LuminaLog Team


Built with ❤️ by the LuminaLog team

Website • Docs • Twitter • GitHub

Metadata

Release files for luminalog-sdk 1.1.0

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

Source distribution (sdist)

Source distribution for luminalog-sdk 1.1.0
File Size Uploaded Provenance Actions
luminalog_sdk-1.1.0.tar.gz 11.0 kB Without provenance Details for luminalog_sdk-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for luminalog-sdk 1.1.0
File Interpreter ABI Platform Actions
luminalog_sdk-1.1.0-py3-none-any.whl Python 3 none any Details for luminalog_sdk-1.1.0-py3-none-any.whl

Total release size: 20.6 kB

Release files / luminalog_sdk-1.1.0.tar.gz

Download URL luminalog_sdk-1.1.0.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
3c75c1937a9a220868d83a5c944af8cc36ef424d20c73dd8a30d62ac1ce97b2e
BLAKE2b-256 checksum
How to use checksums
abcc3489858739d5c3046744933e95bbbd22aea226e554118035e32e93381fab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.20

Release files / luminalog_sdk-1.1.0-py3-none-any.whl

Download URL luminalog_sdk-1.1.0-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a60df78f01b571ea09b35e622a5e7074da71f798413df1a4f4cf533fca72caa3
BLAKE2b-256 checksum
How to use checksums
d1938dbd16cebf5e49d6ce4e414381490ad68e2a77c89c31c796d06241d3cd99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.20

Security for luminalog-sdk 1.1.0

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.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files No provenance

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