pub struct AccessLog { /* private fields */ }Expand description
Buffered emitter. Per-handler call sites push entries via
AccessLog::record; a background task drains the buffer and writes
one S3 object per flush window.
Implementations§
Source§impl AccessLog
impl AccessLog
pub fn new(dest: AccessLogDest) -> Self
Sourcepub fn with_hmac_key(self, key: Arc<AuditHmacKey>) -> Self
pub fn with_hmac_key(self, key: Arc<AuditHmacKey>) -> Self
v0.5 #31: turn on tamper-evident HMAC chaining. Every emitted
line gets a trailing hex HMAC column, and each new batch file
starts with a # prev_file_tail=<hex> comment so the chain
extends across rotations. Without this builder, lines are
emitted exactly as before (back-compat with v0.4 #20 readers).
pub async fn record(&self, entry: AccessLogEntry)
Sourcepub fn spawn_flusher(&self, shutdown: Option<Arc<Notify>>) -> JoinHandle<()>
pub fn spawn_flusher(&self, shutdown: Option<Arc<Notify>>) -> JoinHandle<()>
Spawn the background flusher. Drains the buffer every
flush_every_secs (default 60) and appends to the per-hour file
in dest.dir. Returns the tokio JoinHandle so the caller can
abort on shutdown if needed.
v0.8.5 #81 (audit H-7): the optional shutdown notifier lets the
listener loop signal the flusher to drain the buffer one final
time and exit cleanly on SIGTERM / SIGINT — without this, the
detached task would keep ticking past the listener loop break and
the process would only stop because tokio drops the runtime out
from under it (any in-flight write would be torn at an arbitrary
boundary). None keeps the legacy “tick forever” behaviour for
callers (chiefly tests) that don’t drive a shutdown signal.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for AccessLog
impl !UnwindSafe for AccessLog
impl Freeze for AccessLog
impl Send for AccessLog
impl Sync for AccessLog
impl Unpin for AccessLog
impl UnsafeUnpin for AccessLog
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
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>
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