Metadata-Version: 2.4
Name: shared-error-handler
Version: 1.0.0
Summary: Centralized, reusable error-handling and structured-logging package for Python/FastAPI applications.
License: MIT
Keywords: error-handling,logging,fastapi,middleware,structured-logging
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: fastapi>=0.111.0
Requires-Dist: starlette>=0.37.0
Requires-Dist: pydantic[email]>=2.0
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
Requires-Dist: httpx>=0.27; extra == "dev"
Requires-Dist: uvicorn>=0.29; extra == "dev"

# shared-error-handler

Centralized, reusable error-handling and structured-logging package for Python/FastAPI applications.

## Install

```bash
pip install shared-error-handler
```

## Quick start

```python
from shared_error_handler import setup_error_handling, get_logger
from fastapi import FastAPI

app = FastAPI()
setup_error_handling(app, service_name="my-api")

logger = get_logger(__name__, color=True)
logger.info("Ready")
```

## Logger

```python
from shared_error_handler.logger import get_logger

logger = get_logger(__name__)          # structured JSON (production)
logger = get_logger(__name__, color=True)  # colored terminal (dev)
```

## Exceptions

```python
from shared_error_handler import NotFoundError, ValidationError, ForbiddenError

raise NotFoundError(developer_message="User not found", context={"id": uid})
```

## License

MIT
