Metadata-Version: 2.4
Name: sysstra-logging
Version: 0.2.0
Summary: Shared structured (JSON-line) logging for Sysstra services — stdlib-only, no SDK dependency.
Home-page: https://github.com/sysstra/sysstra-logging
Author: Anurag Singh Kushwah
Author-email: anurag@sysstra.com
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python
Dynamic: summary

# sysstra-logging

Shared structured (JSON-line) logging for Sysstra services. Stdlib-only —
zero install dependencies — so lean scripts (data-collection streamers,
cron jobs) can pick it up without pulling in the full `sysstra` SDK
(pandas/numpy/numba/redis/pymongo).

```python
from sysstra_logging import get_logger, bind, clear_context

logger = get_logger("trading-strategies", log_file="logs/syss_sha_eios.jsonl")

bind(mode="lt", request_id=request_id, strategy="syss_sha_eios")
logger.info("order placed", extra={"order_id": order_id})
```

Set `LOG_FORMAT=text` for a human-readable formatter during local dev /
`tail -f`; the default is single-line JSON.

`clear_context()` must be called at the start of every unit of work (Celery
task, HTTP request) that reuses a process/thread — otherwise bound fields
from a previous task (most dangerously `mode`, paper vs. real-money) leak
into the next one's log lines.

See `sysstra_logging/logging_utils.py` for the full API
(`bound()`, `get_context()`, `redirect_stdout_to()`, `ScrubFilter`).
