Skip to main content

RedactionLogger

Trait RedactionLogger 

Source
pub trait RedactionLogger: Send + Sync {
    // Required method
    fn log(&self, entry: &RedactionEntry) -> Result<(), RedactionLogError>;
}
Expand description

Trait for audit sinks that receive redaction metadata.

Implement this for custom audit backends (remote telemetry, structured JSON logs). For SQLite-backed persistence, use gaze_audit::SqliteLogger.

§Contract

The logger receives metadata only: class, action, session ID, timestamp, and other bytes-free audit labels. It never receives the original PII value or the token value. A custom impl that augments entries with raw document text violates the audit isolation contract and will be flagged by the gaze_module_isolation Dylint lint when it lives in the wrong crate.

§Example

use std::sync::atomic::{AtomicUsize, Ordering};
use gaze_types::{RedactionEntry, RedactionLogError, RedactionLogger};

#[derive(Default)]
struct CountLogger(AtomicUsize);

impl RedactionLogger for CountLogger {
    fn log(&self, _entry: &RedactionEntry) -> Result<(), RedactionLogError> {
        self.0.fetch_add(1, Ordering::Relaxed);
        Ok(())
    }
}

Required Methods§

Source

fn log(&self, entry: &RedactionEntry) -> Result<(), RedactionLogError>

Records a metadata-only redaction entry.

Implementors§