Metadata-Version: 2.4
Name: auralog
Version: 0.1.1
Summary: Auralog Python SDK — agentic logging and application awareness.
Project-URL: Homepage, https://auralog.ai
Project-URL: Documentation, https://docs.auralog.ai
Project-URL: Repository, https://github.com/auralog-ai/auralog-python
Project-URL: Issues, https://github.com/auralog-ai/auralog-python/issues
Project-URL: Changelog, https://github.com/auralog-ai/auralog-python/blob/main/CHANGELOG.md
Author-email: James Thomas <james.c.e.thomas@gmail.com>
License: MIT License
        
        Copyright (c) 2026 James Thomas
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: ai,claude,error-tracking,logging,monitoring,observability
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: System :: Logging
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27
Provides-Extra: dev
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pytest-httpx>=0.30; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff>=0.5; extra == 'dev'
Description-Content-Type: text/markdown

# auralog

Python SDK for [Auralog](https://auralog.ai) — agentic logging and application awareness.

Auralog uses Claude as an on-call engineer: it monitors your logs and errors, alerts you when something's wrong, and opens fix PRs automatically.

[![PyPI version](https://img.shields.io/pypi/v/auralog.svg?label=pypi&color=blue)](https://pypi.org/project/auralog/)
[![provenance verified](https://img.shields.io/badge/provenance-verified-2dba4e?logo=sigstore&logoColor=white)](https://pypi.org/project/auralog/)
[![Python versions](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-blue.svg)](https://pypi.org/project/auralog/)
[![license](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)

## Install

```bash
pip install auralog
```

## Quick start

```python
from auralog import init, auralog

init(api_key="aura_your_key", environment="production")

auralog.info("user signed in", metadata={"user_id": "123"})
auralog.error("payment failed", metadata={"order_id": "abc"})
```

Python 3.10+.

## Bridge the stdlib `logging` module (recommended for existing codebases)

Python's `logging` module is used everywhere — including frameworks (Django, Flask, FastAPI) and libraries (requests, SQLAlchemy, Celery). `AuralogHandler` captures those logs without requiring code changes:

```python
import logging
from auralog import init, AuralogHandler

init(api_key="aura_your_key", environment="production")

logging.getLogger().addHandler(AuralogHandler())
logging.getLogger().setLevel(logging.INFO)

# Any existing logging.* calls — including from third-party libraries — flow to auralog
logging.info("payment processed", extra={"order_id": "abc"})
```

## Configuration

| Option | Type | Default | Description |
|---|---|---|---|
| `api_key` | `str` | _required_ | Your Auralog project API key |
| `environment` | `str` | `"production"` | e.g. `"production"`, `"staging"`, `"dev"` |
| `endpoint` | `str` | `https://ingest.auralog.ai` | Ingest endpoint override |
| `flush_interval` | `float` | `5.0` | Seconds between batched flushes (errors flush immediately) |
| `capture_errors` | `bool` | `True` | Capture uncaught exceptions (main thread, threads, asyncio) |

## Attaching a traceback

```python
try:
    risky()
except Exception as e:
    auralog.error("task crashed", metadata={"task": "ingest"}, exc_info=e)
```

## Graceful shutdown

`auralog` flushes pending logs on interpreter exit automatically via `atexit`. For deterministic flush (serverless handlers, short-lived scripts):

```python
from auralog import shutdown
shutdown()
```

## Thread and async safety

- **Threads:** The transport uses a `threading.Lock` around the in-memory batch. Safe for multi-threaded apps (Django under Gunicorn, FastAPI workers, Celery).
- **Background flushing:** A daemon thread flushes every `flush_interval` seconds; errors send immediately on a separate endpoint.
- **Asyncio:** Error capture installs a handler on the active event loop when `init()` runs inside one. Call `init()` from your framework's startup hook so it installs against your app's loop.

## Verify this package

Every release is published with [sigstore provenance attestations](https://docs.pypi.org/trusted-publishers/) via GitHub Actions. The attestation proves the distribution was built from a specific commit in this repository — without having to trust PyPI or the maintainer.

Inspect the attestation on [pypi.org/project/auralog](https://pypi.org/project/auralog/) under "Provenance".

## Documentation

Full docs at [docs.auralog.ai](https://docs.auralog.ai/python-sdk/installation/).

## Security

Found a vulnerability? See [SECURITY.md](./SECURITY.md) for how to report it.

## License

[MIT](./LICENSE) © James Thomas
