Integration · Python logging
Protect Python logs
Attach the filter to every emitting handler so records are sanitized at the output boundary.
01 · Python logging
Install
The adapters package follows the Python core release independently.
python -m pip install redact-secret-adapters==0.1.502 · Python logging
Attach the filter
The filter covers only handlers that receive it. Put it on every emitting handler rather than assuming the logger applies it everywhere.
import logging
from redact_secret_adapters.logging_filter import RedactSecretFilter
handler = logging.StreamHandler()
handler.addFilter(RedactSecretFilter())
logging.getLogger().addHandler(handler)