Metadata-Version: 2.4
Name: structlogx
Version: 0.1.1
Summary: A simple Python logging package
Home-page: https://github.com/Lethonium/structlogx
Author: lethonium
Author-email: info@lethonium.com
License: MIT
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: python-json-logger
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# structlogx
A lightweight, production-ready JSON logger for Python with built-in structured logging, epoch timestamps, and source context (filename, line number, function name).

## Features

- âœ… Outputs logs in JSON format for easy parsing
- âœ… Automatically includes epoch timestamp (`timestamp`)
- âœ… Adds source context: `filename`, `lineno`, `funcName`
- âœ… Configurable log level via `LOG_LEVEL` environment variable
- âœ… Zero external dependencies beyond `python-jsonlogger`
- âœ… Drop-in replacement for standard `logging` module

## Installation

```bash
pip install structlogx
```

## Usage

```python
import logging
from json_logger import init_logger

# Initialize the logger
init_logger()

# Use standard logging
logging.info("User logged in", extra={"user_id": 123})
logging.error("Failed to process request", extra={"error_code": 500})
```

Output:
```json
{
  "timestamp": 1726578901.234,
  "levelname": "INFO",
  "message": "User logged in",
  "filename": "app.py",
  "lineno": 10,
  "funcName": "login_handler",
  "user_id": 123
}
```

## Environment Variables

| Variable | Default | Description |
|----------|---------|-------------|
| `LOG_LEVEL` | `INFO` | Set log level: `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL` |

## Development

To install in development mode:

```bash
pip install -e .
```

## License

MIT
