Class LoggingRedactionAuditListener
- All Implemented Interfaces:
RedactionAuditListener
RedactionAuditListener — emits one structured
log line per audit event (issue #80).
Use this as the zero-config default when wiring
AuditingRedactor: operators get a basic compliance audit
trail without writing any code, and the line format is shaped for
easy parsing by Datadog / Loki / Splunk.
Redactor audited = new AuditingRedactor(
PatternRedactor.withDefaults(),
LoggingRedactionAuditListener.atInfo());
Output shape: each event becomes one log line at the configured level (default INFO; CRITICAL severity always escalates to WARN regardless of the configured floor):
redaction.applied scope=MEMORY_WRITE severity=CRITICAL total=2 patterns=credit_card:1,email:1 tenant=acme session=s-42 trace=ab12cd
What's omitted on purpose: the redacted content itself,
the placeholder strings, and the offset spans. The audit log is a
counter / metadata log — never a leak vector. Operators who need
the placeholders for grep-then-vault correlation should write a
custom listener that pulls from RedactionAuditEvent.eventId().
Thread-safety: SLF4J Logger is thread-safe; this
class is stateless beyond the immutable level config.
- Since:
- 0.9.0 (issue #80)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumLog levels supported by the listener — mirrorsLogger's standard levels minus ERROR (audit success isn't an error). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionatDebug()Convenience: log at DEBUG floor for noisy environments.atInfo()Convenience: log at INFO floor (CRITICAL still escalates to WARN).voidonRedaction(RedactionAuditEvent event) Called once per scrub that produced at least one finding.
-
Constructor Details
-
LoggingRedactionAuditListener
- Parameters:
floor- minimum log level for non-critical events; CRITICAL severity always escalates to WARN regardless
-
-
Method Details
-
atInfo
Convenience: log at INFO floor (CRITICAL still escalates to WARN). -
atDebug
Convenience: log at DEBUG floor for noisy environments. -
onRedaction
Description copied from interface:RedactionAuditListenerCalled once per scrub that produced at least one finding. Implementations should not throw — theAuditingRedactordecorator catches anything to keep audit failures from breaking the redaction hot path, but a clean implementation never relies on that safety net.- Specified by:
onRedactionin interfaceRedactionAuditListener- Parameters:
event- aggregated audit info; never null
-