Skip to main content

AuditLog

Struct AuditLog 

Source
pub struct AuditLog {
    pub path: PathBuf,
}
Available on crate feature std only.
Expand description

Data structure representing audit log.

Fields§

§path: PathBuf

Path for this value.

Implementations§

Source§

impl AuditLog

Source

pub fn beside_state(state_path: &Path) -> Self

Performs beside state for this type.

Source

pub fn append(&self, event: AuditEvent) -> Result<()>

Performs append for this type.

Source

pub fn append_with_max_bytes( &self, event: AuditEvent, max_bytes: u64, ) -> Result<()>

Append an event with an explicit maximum audit-file size in bytes.

The check and append are serialized across cooperating local writers. A zero limit rejects every record; use u64::MAX for an effectively unlimited file. Existing bytes are never truncated or rotated.

Source

pub fn append_with_privacy( &self, event: AuditEvent, redact_user_content: bool, ) -> Result<()>

Append an event, optionally replacing user-provided text fields before serialization.

Source

pub fn append_with_privacy_and_max_bytes( &self, event: AuditEvent, redact_user_content: bool, max_bytes: u64, ) -> Result<()>

Append an event with privacy redaction and an explicit maximum file size.

Source

pub fn tail(&self, n: usize) -> Result<Vec<AuditRecord>>

Performs tail for this type.

Source

pub fn read_all(&self) -> Result<Vec<AuditRecord>>

Read and validate every complete JSONL record.

A malformed trailing line is an error here; use poll_after to retain an incomplete trailing record while a writer is still appending.

Source

pub fn byte_len(&self) -> Result<u64>

Current file length in bytes (0 if missing). Use as the cursor for AuditLog::poll_after.

Source

pub fn poll_after(&self, offset: u64) -> Result<(Vec<AuditRecord>, u64)>

Read complete JSONL records written after offset bytes.

Returns (new_records, new_offset). Incomplete trailing lines are left for a later poll (offset does not advance past them).

Source

pub fn summarize(&self) -> Result<AuditSummary>

Performs summarize for this type.

Auto Trait Implementations§

§

impl Forget for AuditLog

§

impl Freeze for AuditLog
where *const u8 is !null: Freeze, PhantomData<u8>: Freeze,

§

impl Move for AuditLog

§

impl RefUnwindSafe for AuditLog

§

impl Send for AuditLog
where RawVecInner: Send,

§

impl Sync for AuditLog
where RawVecInner: Sync,

§

impl Unpin for AuditLog
where *const u8 is !null: Unpin,

§

impl UnsafeUnpin for AuditLog

§

impl UnwindSafe for AuditLog
where RawVecInner: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more