pub struct RequestLogger { /* private fields */ }Expand description
In-memory ring buffer request logger.
Implementations§
Source§impl RequestLogger
impl RequestLogger
Sourcepub fn new(config: RequestLogConfig) -> Self
pub fn new(config: RequestLogConfig) -> Self
Create a new request logger.
Sourcepub fn record(
&mut self,
method: &str,
path: &str,
status: u16,
latency: Duration,
client_key: &str,
)
pub fn record( &mut self, method: &str, path: &str, status: u16, latency: Duration, client_key: &str, )
Record a request.
Sourcepub fn config(&self) -> &RequestLogConfig
pub fn config(&self) -> &RequestLogConfig
Get the configuration.
Sourcepub fn update_config(&mut self, capacity: Option<usize>, enabled: Option<bool>)
pub fn update_config(&mut self, capacity: Option<usize>, enabled: Option<bool>)
Update the configuration at runtime.
Sourcepub fn recent(
&self,
limit: usize,
filter: Option<&LogFilter>,
) -> Vec<&RequestLogEntry>
pub fn recent( &self, limit: usize, filter: Option<&LogFilter>, ) -> Vec<&RequestLogEntry>
Get recent entries (newest first), optionally filtered.
Sourcepub fn total_requests(&self) -> u64
pub fn total_requests(&self) -> u64
Total requests recorded (including evicted).
Auto Trait Implementations§
impl Freeze for RequestLogger
impl RefUnwindSafe for RequestLogger
impl Send for RequestLogger
impl Sync for RequestLogger
impl Unpin for RequestLogger
impl UnsafeUnpin for RequestLogger
impl UnwindSafe for RequestLogger
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> 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 moreCreates a shared type from an unshared type.