Skip to main content

LoggerAI for Python

Performance monitoring, errors, logs and health checks for FastAPI, Starlette, Django, Flask and Celery, with AI that explains what went wrong.

  • Every endpoint timed under its route template (/orders/{order_id}): p50/p95/p99, Apdex, status codes, slow and failed requests.
  • What each request waits on: database queries (SQLAlchemy and Django), outgoing HTTP (httpx, requests), Redis.
  • Exceptions, grouped by cause, with stack traces that show your code first.
  • Logs at warning and above.
  • Health checks you define (database, cache, a queue).
  • Background work (Celery tasks, scripts) timed like requests.
  • Browser sessions recorded by LoggerAI's browser script link to the server request each click caused (traceparent, x-loggerai-session).

The package is loggerai-sdk; you import it as loggerai.

Secrets (passwords, tokens, cookies, API keys, JWTs) are masked before anything leaves your server, request and response bodies are never sent, and users are counted by a one-way hash of their id. No dependencies; Python 3.8+.

Install

pip install loggerai-sdk

Get your project's secret key (sk_live_...) from LoggerAI → your project → Connect, and set it in the environment:

LOGGERAI_KEY=sk_live_...
LOGGERAI_RELEASE=$GIT_SHA      # optional: "since release X"

Without a key nothing is recorded or sent, so local development stays quiet.

FastAPI / Starlette

import loggerai
from loggerai.asgi import LoggerAIMiddleware

loggerai.init()
app = FastAPI()
app.add_middleware(LoggerAIMiddleware)

Django

# settings.py
import loggerai
loggerai.init()

MIDDLEWARE = [
    "loggerai.django.LoggerAIMiddleware",   # first
    ...
]

Flask

import loggerai, loggerai.flask

loggerai.init()
app = Flask(__name__)
loggerai.flask.instrument(app)

Celery

import loggerai, loggerai.celery

loggerai.init(service="worker")
loggerai.celery.instrument()

Any other WSGI app

from loggerai.wsgi import LoggerAIMiddleware
application = LoggerAIMiddleware(application)

Health checks

def database():
    with engine.connect() as c:
        c.execute(text("SELECT 1"))
    return True               # or (False, "why")

loggerai.init(health_checks={"database": database, "redis": lambda: r.ping()})

They run every minute in the background and show on the project's health page; alert on them from the dashboard.

More

loggerai.set_user(request.user.id)          # only a one-way hash is sent

with loggerai.measure("api.stripe.com", "POST"):   # calls it can't see itself
    stripe.PaymentIntent.confirm(intent_id)

with loggerai.track("job", "send_invoices"):       # scripts, cron jobs
    send_invoices()

try:
    risky()
except ValueError as e:
    loggerai.capture_exception(e, order=order.id)  # handled, but worth seeing

loggerai.flush()     # at the end of a short script or a serverless call

Settings

Environment init() Default
LOGGERAI_KEY key — Secret key; off without it
LOGGERAI_SERVICE service app Name this process (api, worker)
LOGGERAI_ENVIRONMENT environment production Separates production from staging
LOGGERAI_RELEASE release — Version or git SHA
LOGGERAI_ENABLED enabled true Turn it off without removing the key
logs_level "WARNING" Lowest log level sent; None for no logs
ignore_paths /health, /up, … Paths not recorded
capture_queries, capture_http, capture_redis True
flush_interval 5 Seconds between batches

How it sends

Records are kept in memory and sent from a background thread every few seconds, gzipped, with a 2-second timeout. Requests never wait on LoggerAI. If it can't be reached, records are dropped instead of piling up. With gunicorn or uWSGI, each worker process sends its own batches.

Support

dev@loggerai.uk · https://loggerai.uk

Metadata

Release files for loggerai-sdk 0.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 loggerai-sdk 0.1.0
File Size Uploaded
loggerai_sdk-0.1.0.tar.gz 18.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for loggerai-sdk 0.1.0
File Interpreter ABI Platform
loggerai_sdk-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 39.3 kB

Release files / loggerai_sdk-0.1.0.tar.gz

Download URL loggerai_sdk-0.1.0.tar.gz
Size 18.6 kB
Tags Source
SHA-256 checksum
How to use checksums
da86428220312d7cb78f558d06f8aecd9a12a467d11f0b71281318f2e66e0072
BLAKE2b-256 checksum
How to use checksums
f01602be114770c87564ae1d3ed72e3e7274fc0ed177b9b41bfbc75bebffe1da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Release files / loggerai_sdk-0.1.0-py3-none-any.whl

Download URL loggerai_sdk-0.1.0-py3-none-any.whl
Size 20.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
53a8ce508fe29f09571d196206a51f923fca859fd105130f7a49b2e86f8bdf3f
BLAKE2b-256 checksum
How to use checksums
03a1db2451443c0e780948c095d35f885400e30c0e2cfce91e4a4a70a50b0994
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Release history Release notifications | RSS feed

0.2.0

2 release files

0.1.1

2 release files

This release

0.1.0 This release

2 release files

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