Skip to main content

Lognitor SDK for Python — log management, error tracking, and monitoring

Project description

lognitor

Official Lognitor SDK for Python — log management, error tracking, and monitoring.

Install

pip install lognitor

Quick Start

import lognitor

lognitor.init(
    api_key="your-api-key",
    service="my-python-app",
    environment="production",
)

lognitor.info("Server started", metadata={"port": 8000})

Log Levels

lognitor.debug("Cache miss", metadata={"key": "user:123"})
lognitor.info("Order created", metadata={"order_id": "ord_456"})
lognitor.warn("Rate limit approaching")
lognitor.error("Payment failed", error=ValueError("Card declined"))
lognitor.fatal("Database corrupted")

Error Tracking

try:
    process_payment(order)
except Exception as e:
    lognitor.capture_exception(e, metadata={"order_id": order.id})

User Context

lognitor.set_user({"id": "user_123", "email": "alice@example.com"})
lognitor.clear_user()

Framework Integrations

Django

# settings.py
MIDDLEWARE = ["lognitor.integrations.django.LognitorMiddleware", ...]
LOGNITOR = {"api_key": "your-key", "service": "my-django-app", "environment": "production"}

Flask

from lognitor.integrations.flask import init_app
client = init_app(app, api_key="your-key", service="my-flask-app")

FastAPI

from lognitor.integrations.fastapi import LognitorMiddleware
app.add_middleware(LognitorMiddleware, api_key="your-key", service="my-fastapi-app")

Configuration

Option Default Description
api_key required Project API key
service None Service name
environment None Environment
batch_size 25 Logs per batch
flush_interval 5.0 Auto-flush interval (seconds)
max_retries 3 Retry count
min_level None Minimum level to send
redact_patterns [] PII patterns to redact
before_send None Transform/filter callback

More

  • Child loggers: lognitor.child(service="payments")
  • Timers: t = lognitor.start_timer(); t.end("Done")
  • Heartbeat: lognitor.heartbeat("token").wrap(lambda: job())
  • Releases: lognitor.register_release(version="2.0")
  • Python logging bridge: from lognitor.logging_handler import LogHandler

Full documentation: docs.lognitor.com

Compatibility

Python 3.8+. No external dependencies.

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

lognitor-1.0.2.tar.gz (20.7 kB view details)

Uploaded Source

Built Distribution

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

lognitor-1.0.2-py3-none-any.whl (26.5 kB view details)

Uploaded Python 3

File details

Details for the file lognitor-1.0.2.tar.gz.

File metadata

  • Download URL: lognitor-1.0.2.tar.gz
  • Upload date:
  • Size: 20.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for lognitor-1.0.2.tar.gz
Algorithm Hash digest
SHA256 aa5d6752f8cdf11865b82bf9223aaacbb15fc8d5bff7c8e32aa2db4e42f0df36
MD5 2abb993faca679c7c8ce28c006c6278a
BLAKE2b-256 8709025c293e97aab3e7a069fb7992a13b0271ab9015baa06b148b46432ef8aa

See more details on using hashes here.

File details

Details for the file lognitor-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: lognitor-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 26.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for lognitor-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0c9d8b0c0625fc11109601b7fd62fcdf32de242141e6316c5a76fba306760597
MD5 1e7f59893ed68414967806b23b62d640
BLAKE2b-256 160bf5412810eb93cc6f394134dfc24d1cb05566fd48d7fc4a8062d906c444b9

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