1. Redacting logger
medium25 XPWrite redact(obj) returning a deep copy of nested dicts/lists where (a) any dict key that (case-insensitively) contains password, secret, api_key or authorization, or ends with token, has its value replaced by "[REDACTED]", and (b) email addresses inside any string are replaced with "[EMAIL]". Non-container values pass through. Then log_event(event, **fields) -> str returns a JSON line {"event": ..., **redacted fields} with sorted keys.
Ctrl/⌘ + Enter runs the tests · Esc then Tab leaves the editor