pub struct AuditLog { /* private fields */ }Expand description
Append-only audit logger that writes to a local JSONL file.
Implementations§
Source§impl AuditLog
impl AuditLog
pub fn new() -> Result<Self>
Sourcepub fn with_path(path: PathBuf) -> Result<Self>
pub fn with_path(path: PathBuf) -> Result<Self>
Construct an AuditLog at a caller-provided path. Used by tests so they
don’t pollute the real audit log at ~/.local/share/audex/audit/audit.jsonl.
pub fn log(&self, session_id: &str, event: AuditEvent) -> Result<()>
pub fn log_with_provider( &self, session_id: &str, provider: &str, event: AuditEvent, ) -> Result<()>
pub fn log_session_created(&self, session: &Session) -> Result<()>
pub fn log_session_ended( &self, session: &Session, exit_code: Option<i32>, ) -> Result<()>
Sourcepub fn read(&self, session_id: Option<&str>) -> Result<Vec<AuditEntry>>
pub fn read(&self, session_id: Option<&str>) -> Result<Vec<AuditEntry>>
Read all audit entries, optionally filtered by session ID.
Sourcepub fn read_filtered(
&self,
session_id: Option<&str>,
provider: Option<&str>,
) -> Result<Vec<AuditEntry>>
pub fn read_filtered( &self, session_id: Option<&str>, provider: Option<&str>, ) -> Result<Vec<AuditEntry>>
Read audit entries with optional session ID and provider filters.
Sourcepub fn verify(&self) -> Result<VerificationResult>
pub fn verify(&self) -> Result<VerificationResult>
Verify the integrity of the audit log using chain HMACs.
pub fn path(&self) -> &PathBuf
Auto Trait Implementations§
impl Freeze for AuditLog
impl RefUnwindSafe for AuditLog
impl Send for AuditLog
impl Sync for AuditLog
impl Unpin for AuditLog
impl UnsafeUnpin for AuditLog
impl UnwindSafe for AuditLog
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.