Error capture
With capture_errors=True (the default), the SDK hooks into:
sys.excepthook— uncaught exceptions on the main threadthreading.excepthook— uncaught exceptions in threads- The active asyncio event loop’s exception handler
No manual instrumentation required.
Opt out
Section titled “Opt out”init(api_key="...", environment="prod", capture_errors=False)Async frameworks (FastAPI, etc.)
Section titled “Async frameworks (FastAPI, etc.)”In async apps, call init() inside the running event loop so the asyncio handler installs against the loop you’re actually using. A typical FastAPI startup hook:
from fastapi import FastAPIfrom auralog import init
app = FastAPI()
@app.on_event("startup")def _auralog_startup(): init(api_key="aura_your_api_key", environment="production")Explicit error reporting
Section titled “Explicit error reporting”Even with automatic capture, you can attach context at a catch site:
try: process_order(order_id)except OrderError as e: auralog.error( "order processing failed", metadata={"order_id": order_id}, exc_info=e, ) raiseThis gives you the log entry with the traceback AND re-raises so existing error handling continues to work.
Django
Section titled “Django”Django’s own error handling doesn’t go through sys.excepthook — requests are handled within the framework. To capture unhandled exceptions from request handlers, use the AuralogHandler on Django’s logger configuration or install middleware.
A simple configuration:
LOGGING = { "version": 1, "disable_existing_loggers": False, "handlers": { "auralog": {"class": "auralog.AuralogHandler", "level": "INFO"}, }, "root": {"handlers": ["auralog"], "level": "INFO"}, "loggers": { "django.request": {"handlers": ["auralog"], "level": "ERROR", "propagate": False}, },}Threading
Section titled “Threading”Background threads are handled automatically via threading.excepthook:
import threadingfrom auralog import init
init(api_key="aura_your_api_key", environment="production")
def worker(): raise RuntimeError("background worker died")
# This exception will surface in Auralog — no extra setupthreading.Thread(target=worker).start()