Metadata-Version: 2.4
Name: ScoloLogger
Version: 0.1.0
Summary: Structured, context-aware logging for Python applications.
Author: G3tFun
License-Expression: MIT
Project-URL: Homepage, https://github.com/G3tFun/ScoloLogger
Project-URL: Repository, https://github.com/G3tFun/ScoloLogger
Project-URL: Documentation, https://github.com/G3tFun/ScoloLogger#readme
Project-URL: Issues, https://github.com/G3tFun/ScoloLogger/issues
Keywords: logging,structured-logging,json-logging,observability,contextvars
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
Classifier: Topic :: System :: Logging
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == "dev"
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: ruff>=0.6; extra == "dev"
Dynamic: license-file

# ScoloLogger

ScoloLogger is a structured logging layer built on Python's standard `logging` package. It supports JSON events, task-local context, secret redaction, and timed operations without changing global logging configuration on import.

## Installation

```bash
pip install ScoloLogger
```

## Configure an application

```python
from scolologger import configure, get_logger

configure(level='INFO', json_output=True)
log = get_logger('checkout')
log.info('payment.accepted', order_id=42, amount=19.90)
```

JSON output is suitable for Docker, systemd, log collectors, and observability platforms. Use `json_output=False` for local development.

## Context

Context is stored with `contextvars`, so concurrent asyncio tasks do not overwrite one another.

```python
from scolologger import context, get_logger, new_trace_id

log = get_logger('api')

with context(trace_id=new_trace_id(), user_id=17):
    log.info('request.received', method='POST', path='/orders')
    log.info('order.created', order_id=42)
```

A logger can also carry permanent fields:

```python
bot_log = get_logger('scolocrizm').bind(component='telegram')
bot_log.info('request.completed', method='sendMessage', status=200)
```

## Secret redaction

Fields whose names contain `token`, `secret`, `password`, `authorization`, `cookie`, or `api_key` are replaced with `[REDACTED]`. Telegram bot-token patterns are also removed from strings. Nested dictionaries and lists are processed recursively.

```python
log.info('bot.started', bot_token='123456:secret')
# fields.bot_token is emitted as "[REDACTED]"
```

## Spans

```python
from scolologger import get_logger, span

log = get_logger('worker')

with span(log, 'invoice.sync', invoice_id=42):
    synchronize_invoice(42)
```

The span records `invoice.sync.started` and either `invoice.sync.finished` or `invoice.sync.failed`, including `elapsed_ms`.

## Library authors

Use `get_logger()` inside a reusable package, but do not call `configure()`. The application owns levels, handlers, output destinations, and retention.

## License

MIT.
