pub struct AuditLogger { /* private fields */ }Expand description
Append-only audit logger that records each module execution to a JSONL file.
When constructed with path = None, logging is a no-op (disabled).
Implementations§
Source§impl AuditLogger
impl AuditLogger
Sourcepub fn default_path() -> Option<PathBuf>
pub fn default_path() -> Option<PathBuf>
Return the default path: ~/.apcore-cli/audit.jsonl.
Sourcepub fn new(path: Option<PathBuf>) -> Self
pub fn new(path: Option<PathBuf>) -> Self
Create a new AuditLogger.
§Arguments
path— path to the JSONL audit log file;Noneuses the default path~/.apcore-cli/audit.jsonl.
Sourcepub fn log_execution(
&self,
module_id: &str,
input_data: &Value,
status: &str,
exit_code: i32,
duration_ms: u64,
)
pub fn log_execution( &self, module_id: &str, input_data: &Value, status: &str, exit_code: i32, duration_ms: u64, )
Log a single module execution event.
Appends one JSON line to the audit log. IO failures emit a
tracing::warn! and are otherwise ignored — this method never panics
or propagates an error.
§Fields written
timestamp— ISO 8601 UTC timestampuser— username fromUSER/LOGNAMEmodule_id— the executed module’s identifierinput_hash— salted SHA-256 of the JSON-serialised inputstatus—"success"or"error"exit_code— process exit codeduration_ms— wall-clock execution time in milliseconds
Trait Implementations§
Source§impl Clone for AuditLogger
impl Clone for AuditLogger
Source§fn clone(&self) -> AuditLogger
fn clone(&self) -> AuditLogger
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto 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