Repository navigation
v0.1.1
Configurable logging with opt-in structured JSON logs (#21)
- Every adapter (
MemoryAdapter,PostgresAdapter,PosthogAdapter) andPosthogAPIClienttakes alogger=argument. It defaults tostructlog.get_logger(), so logs follow your application's structlog configuration. - feature_gate no longer calls
structlog.configure, so creating an adapter no longer replaces your app's structlog config. - New
feature_gate.structured_loggingmodule for JSON logs:json_logger(file=None): JSON-lines logger (stdout by default) to pass aslogger=.PROCESSORS: use withstructlog.configure(processors=PROCESSORS)to render your whole app as JSON.
- See the Logging section of the README.
Breaking changes
MemoryAdapterno longer writes./logs/feature_gate.log, andPosthogAPIClientno longer writes$PROJECT_ROOT/logs/development.log;PROJECT_ROOTis no longer used. To keep a log file, passlogger=json_logger(open("logs/feature_gate.log", "a")).- Logs render however your app has configured structlog (structlog's console output if unconfigured) rather than always as JSON.
This is the first release with these changes on PyPI. 0.1.0 was never published there (PyPI blocks that filename from an earlier deleted upload).
Full Changelog: v0.0.9...v0.1.1