Skip to main content

AccessLogger

Trait AccessLogger 

Source
pub trait AccessLogger: Send + Sync {
    // Required method
    fn log_access<'life0, 'async_trait>(
        &'life0 self,
        actor: Identity,
        resource: AccessedResource,
        purpose: PurposeOfUse,
        correlation_id: Option<Uuid>,
    ) -> Pin<Box<dyn Future<Output = Result<(), AccessLogError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Sink for read-access audit events.

Implementations:

  • NoOpAccessLogger — validates and discards (default in tests, non-PHI apps)
  • RecordingAccessLogger — keeps entries in memory for assertions (test-utils)
  • JetStream-backed (Step 3+)
  • DB-backed (out of scope here)

Required Methods§

Source

fn log_access<'life0, 'async_trait>( &'life0 self, actor: Identity, resource: AccessedResource, purpose: PurposeOfUse, correlation_id: Option<Uuid>, ) -> Pin<Box<dyn Future<Output = Result<(), AccessLogError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Log a read. Implementations validate the input, record it (or not), and return.

Errors are returned but should NOT block the read response in the calling controller — callers typically log the error and continue. Reads MUST NOT silently fail closed when the audit sink is down, because that would mean audit availability bottlenecks every request.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§