What
Add a recipes/logging_filter.py example showing a stdlib logging.Filter that runs redact_args over every log record's args and extra payload before emission.
Expected outcome
- New file
recipes/logging_filter.py (under 60 lines)
- A
RedactionFilter(logging.Filter) subclass with a filter(self, record) method that:
- If
record.args is a Mapping, walks it through redact_args
- If
record.__dict__ contains user-injected extra keys, walks those through redact_args too
- Returns
True (the filter only mutates, never drops)
- A 10-line usage snippet at the bottom showing
logger.addFilter(RedactionFilter())
- README "Three killer examples" gets a bullet linking to this recipe (or add a "Recipes" section)
Why this is good for newcomers
- Pure stdlib, no extra deps
- The filter is small but production-useful
- Pattern translates directly to OTel attribute redaction (a future recipe)
Pointers
- Source:
src/redactkit/core.py — redact_args is the only API needed
- See
CONTRIBUTING.md for dev setup
What
Add a
recipes/logging_filter.pyexample showing a stdliblogging.Filterthat runsredact_argsover every log record'sargsandextrapayload before emission.Expected outcome
recipes/logging_filter.py(under 60 lines)RedactionFilter(logging.Filter)subclass with afilter(self, record)method that:record.argsis aMapping, walks it throughredact_argsrecord.__dict__contains user-injectedextrakeys, walks those throughredact_argstooTrue(the filter only mutates, never drops)logger.addFilter(RedactionFilter())Why this is good for newcomers
Pointers
src/redactkit/core.py—redact_argsis the only API neededCONTRIBUTING.mdfor dev setup