Metadata-Version: 2.4
Name: tracelite-logger
Version: 0.1.0
Summary: Lightweight structured logging and exception tracking for Python applications
Author: Ishoula
License-Expression: MIT
Keywords: logging,debugging,exceptions,monitoring,developer-tools
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# TraceLite

TraceLite is a small, dependency-free Python package for recording structured log events and exceptions.

## Features

- JSON Lines logs (one JSON object per line)
- Console and file output
- Exception type, message, and traceback capture
- Extra context such as request IDs
- `@trace_errors` decorator that logs and re-raises exceptions
- Basic secret redaction for common sensitive field names

## Quick start

```python
from tracelite import TraceLite, trace_errors

logger = TraceLite(log_file="app.log")

logger.info("Application started", context={"service": "demo"})

try:
    10 / 0
except ZeroDivisionError as exc:
    logger.exception("Calculation failed", exc, context={"operation": "divide"})
```

Use the decorator:

```python
from tracelite import TraceLite, trace_errors

logger = TraceLite(log_file="app.log")

@trace_errors(logger)
def calculate():
    return 10 / 0

calculate()  # Logs the exception, then raises it again.
```

## Install for development

```bash
python -m venv .venv
# Windows PowerShell:
.venv\Scripts\Activate.ps1
# macOS/Linux:
# source .venv/bin/activate

python -m pip install -e ".[dev]"
pytest
```

## Notes

- Do not put passwords, access tokens, personal data, or other secrets into log messages.
- TraceLite redacts common sensitive keys in context dictionaries, but no automatic redaction is perfect.
- This first version writes to a local file and/or the console. It does not send data to a remote service.
