Metadata-Version: 2.4
Name: pylogify
Version: 1.0.0
Summary: PII-safe, OTel-correlated JSON logging
Author: Logify
License-Expression: Apache-2.0
Keywords: logging,opentelemetry,pii,redaction,structured-logging
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: System :: Logging
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: opentelemetry-api>=1.27
Dynamic: license-file

# pylogify

PII-safe JSON logging for Python's standard `logging` module. Every line follows the logify log contract (v1) and carries `trace_id` / `span_id` from the active OpenTelemetry span. Emails, card numbers, tokens and other sensitive values are redacted before they are written.

```bash
pip install pylogify
```

The import name is `logify`:

```python
import logging
from logify import setup_logging

setup_logging()   # once, at startup; routes all loggers (uvicorn, gunicorn, django) to JSON stdout
logging.getLogger(__name__).info("order created", extra={"order_id": "o_1"})
logging.getLogger(__name__).info("user role changed", extra={"log_type": "audit", "actor": {"id": "u_1"}})
```

For traces and metrics, run the app with `opentelemetry-instrument` and set `OTEL_EXPORTER_OTLP_ENDPOINT`. `service`, `env` and `version` default to `OTEL_SERVICE_NAME`, `DEPLOY_ENV` and `APP_VERSION`. The redaction rules are bundled in the package and shared with the Node and Java packages. A field in `extra=` named like a contract field (`level`, `service`, `error`, ...) is written as `extra_<name>` so it can't overwrite the contract.

Licensed under Apache-2.0.
