pub struct AuditLogger { /* private fields */ }Expand description
Async writer that appends AuditEntry records to a structured JSONL log.
Create via AuditLogger::from_config and share behind an Arc. Each executor
that should emit audit records accepts the logger via a builder method
(e.g. ShellExecutor::with_audit).
§Thread safety
File writes are serialized through an internal tokio::sync::Mutex<File>.
Multiple concurrent log calls are safe but may block briefly on the mutex.
Implementations§
Source§impl AuditLogger
impl AuditLogger
Sourcepub async fn from_config(config: &AuditConfig) -> Result<Self, Error>
pub async fn from_config(config: &AuditConfig) -> Result<Self, Error>
Create a new AuditLogger from config.
§Errors
Returns an error if a file destination cannot be opened.
Sourcepub async fn log(&self, entry: &AuditEntry)
pub async fn log(&self, entry: &AuditEntry)
Serialize entry to JSON and append it to the configured destination.
Serialization errors are logged via tracing::error! and silently swallowed so
that audit failures never interrupt tool execution.
Trait Implementations§
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