Python SDK for Vestara crash reporting and remote logging.
Project description
Vestara Python SDK
Server-side Python SDK for Vestara crash reporting and remote logging.
Requires Python 3.8+ — zero external runtime dependencies.
Installation
pip install vestara
Quick Start
import vestara
vestara.init(
token="YOUR_SDK_TOKEN",
environment="production",
app_version="1.0.0",
target_category="python_worker",
service_name="Python Worker",
app_identifier="python-worker",
)
vestara.log("info", "Server started", {"port": 3000})
Default endpoint: https://api.vestara.dev. No api_url needed for normal Vestara SaaS usage.
Runtime target metadata
You can provide metadata to identify this application in the dashboard:
target_category: The kind of target (e.g.,python_worker).service_name: Human-readable name (e.g.,Python Worker).app_identifier: Technical identifier (e.g.,python-worker).
API
vestara.init(options)
Initializes the SDK. Must be called before any other API.
vestara.init(
token="YOUR_SDK_TOKEN",
environment="production", # production | staging | development
app_version="1.0.0",
target_category="python_worker",
service_name="Python Worker",
app_identifier="python-worker",
before_send=None, # optional callback
)
before_send hook
The before_send option lets you inspect, modify, or drop events before they are queued:
def redact_sensitive(event):
# Redact sensitive fields
if "password" in event.get("payload", {}).get("data", {}):
event = dict(event)
event["payload"] = dict(event["payload"])
event["payload"]["data"] = dict(event["payload"]["data"])
event["payload"]["data"]["password"] = "[REDACTED]"
return event
# Drop noisy health checks
if event.get("payload", {}).get("message") == "health-check":
return None
return event
vestara.init(
token="YOUR_SDK_TOKEN",
before_send=redact_sensitive,
)
Behavior:
- Return a modified event dict to send the modified version
- Return
Noneto drop the event - If the hook raises an exception, the original event is sent (fail-open)
Note: The Vestara backend also applies server-side redaction as a safety layer.
Optional api_url for local development, staging, or self-hosted:
vestara.init(
token="YOUR_SDK_TOKEN",
api_url="http://localhost:3000",
environment="development",
)
vestara.log(level, message, data?)
Sends a log event.
vestara.log("info", "Request processed", {"request_id": "123"})
vestara.log("warn", "Slow query detected", {"duration": 2000})
vestara.log("error", "Database connection failed", {"host": "db.example.com"})
Supported levels: debug, info, warn, error, fatal.
vestara.capture_exception(error, context?)
Captures a Python exception.
try:
result = process_data()
except Exception as e:
vestara.capture_exception(e, {"operation": "process_data"})
vestara.set_user(context)
Associates a user with future events.
vestara.set_user({"id": "user-123", "email": "user@example.com"})
What is Automatically Captured
- Uncaught exceptions:
sys.excepthookcaptures unhandled exceptions. The original hook is called after capture. - Thread exceptions:
threading.excepthookcaptures uncaught exceptions in threads. The original hook is called after capture. - Graceful shutdown: Remaining events are flushed on process exit via
atexit. - Periodic flush: Events are sent every 10 seconds in a background daemon thread.
What is NOT Supported in V1
- Async/await exceptions: Only synchronous thread exceptions are captured automatically.
- Django/FastAPI/Flask integration: Not built-in. Wrap your exception handlers or call
vestara.capture_exception()manually. - Structured logging frameworks: Not auto-instrumented.
- Distributed tracing / APM: Not implemented.
- Guaranteed persistence: Queue is in-memory only. SIGKILL or sudden process termination will lose queued events.
- File-backed queue: Not implemented.
Offline Queue
Events are queued in memory (not persisted to disk).
- Max 500 events
- Logs dropped (not crashes) when queue is full
- Crash events evict the oldest log when queue is full
- Events are sent in batches of up to 50 every 10 seconds
- Crash events are sent immediately
- Remaining events are flushed on
atexit(best-effort, may not complete on SIGKILL)
Device Settings
The SDK polls /v1/sdk/device-settings every 60 seconds. If logging_enabled is false, log events are suppressed. Crash events are always sent regardless of this setting.
SDK Token
Find your SDK token in the Vestara dashboard under Settings → SDK & Token.
The SDK token is write-only — it can only ingest events. It cannot read your data.
License
This SDK is licensed under the Apache License 2.0.
Copyright 2026 Ahsan Iqbal.
Vestara, the Vestara name, logos, domain, and related branding are not granted under this license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vestara-0.1.2.tar.gz.
File metadata
- Download URL: vestara-0.1.2.tar.gz
- Upload date:
- Size: 17.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f691f3420abf32b9bcb6162c884849a6a8ea46d4bfdefa05085cc4ec96dda29d
|
|
| MD5 |
7a6de97e37181c610bd58cde4389737b
|
|
| BLAKE2b-256 |
be45086796324675dfee1a18eb88fc9fe583826c256b0a91cbe713b60a6f7c49
|
File details
Details for the file vestara-0.1.2-py3-none-any.whl.
File metadata
- Download URL: vestara-0.1.2-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4fab3306202ff98dc6a18bfda7dda0f15b487c8dbc0f7063b3af999d598a7be
|
|
| MD5 |
313ca2c3d37cecc156684c2fbf35a450
|
|
| BLAKE2b-256 |
7846d6e173dfe293dc47ef7da5307d48c5b41de2d1be17cf6f123a76dc619cf6
|