pub struct AuditLogger { /* private fields */ }Expand description
Thread-safe audit logger that appends NDJSON events to a file.
File-level locking (via fs2) ensures safe concurrent access from
multiple processes.
Implementations§
Source§impl AuditLogger
impl AuditLogger
Sourcepub fn open(path: &str) -> Result<Self, IdbError>
pub fn open(path: &str) -> Result<Self, IdbError>
Open (or create) the audit log file in append mode.
Sourcepub fn emit(&self, event: &AuditEvent) -> Result<(), IdbError>
pub fn emit(&self, event: &AuditEvent) -> Result<(), IdbError>
Emit a single audit event as one NDJSON line.
Sourcepub fn start_session(&self, args: Vec<String>) -> Result<(), IdbError>
pub fn start_session(&self, args: Vec<String>) -> Result<(), IdbError>
Emit a session_start event.
Sourcepub fn end_session(&self) -> Result<(), IdbError>
pub fn end_session(&self) -> Result<(), IdbError>
Emit a session_end event with accumulated counters.
Sourcepub fn log_page_write(
&self,
file: &str,
page_number: u64,
operation: &str,
old_checksum: Option<u32>,
new_checksum: Option<u32>,
) -> Result<(), IdbError>
pub fn log_page_write( &self, file: &str, page_number: u64, operation: &str, old_checksum: Option<u32>, new_checksum: Option<u32>, ) -> Result<(), IdbError>
Log a page-level write operation.
Auto Trait Implementations§
impl !Freeze for AuditLogger
impl RefUnwindSafe for AuditLogger
impl Send for AuditLogger
impl Sync for AuditLogger
impl Unpin for AuditLogger
impl UnsafeUnpin for AuditLogger
impl UnwindSafe for AuditLogger
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> 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 more