pub struct AuditLog { /* private fields */ }Expand description
Audit log for recording and persisting phase transitions.
Each audit log has a unique transaction ID and persists events
to .forge/audit/{tx_id}.json for replay capability.
Implementations§
Source§impl AuditLog
impl AuditLog
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new audit log with a fresh transaction ID.
The .forge/audit directory is created if it doesn’t exist.
Sourcepub fn with_dir(audit_dir: PathBuf) -> Self
pub fn with_dir(audit_dir: PathBuf) -> Self
Creates a new audit log with a custom audit directory.
§Arguments
audit_dir- Directory path for audit file storage
Sourcepub async fn record(&mut self, event: AuditEvent) -> Result<(), AuditError>
pub async fn record(&mut self, event: AuditEvent) -> Result<(), AuditError>
Sourcepub fn replay(&self) -> Vec<AuditEvent>
pub fn replay(&self) -> Vec<AuditEvent>
Returns a replay of all recorded events.
§Returns
A clone of all events for transaction reconstruction.
Sourcepub fn into_events(self) -> Vec<AuditEvent>
pub fn into_events(self) -> Vec<AuditEvent>
Converts the audit log into a vector of events.
This consumes the audit log and returns all events.
Trait Implementations§
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more