Context-enriched logging mixin that adds structured fields like request_id, user_id, and service name to logs. Supports optional auto-instrumentation via OpenTelemetry. Current version 0.5.28, released irregularly on PyPI. Requires Python >= 3.12.
pip install csrd-loggingNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Basic usage: configure once, then mixin into classes to enrich logs with context fields.
Call CsrdLoggingMixin.configure() at application startup, ideally before importing any modules that do logging.
Use with self.with_log_context(key=value): instead of self.set_context(key=value).
Always use self.logger from the mixin, not logging.getLogger(__name__).
Upgrade to Python 3.12 or higher.