pub struct LoggingMiddleware { /* private fields */ }
Expand description
Middleware for request/response logging with trace context
Implementations§
Source§impl LoggingMiddleware
impl LoggingMiddleware
Sourcepub fn new(config: LoggingConfig) -> Self
pub fn new(config: LoggingConfig) -> Self
Create a new logging middleware
Sourcepub fn config(&self) -> &LoggingConfig
pub fn config(&self) -> &LoggingConfig
Get a reference to the logging configuration
Sourcepub fn process<B>(
&self,
req: Request<B>,
remote_addr: Option<SocketAddr>,
) -> (Request<B>, RequestInfo)
pub fn process<B>( &self, req: Request<B>, remote_addr: Option<SocketAddr>, ) -> (Request<B>, RequestInfo)
Process a request and add trace context
Sourcepub fn log_response<B>(
&self,
response: &Response<B>,
request_info: &RequestInfo,
upstream_duration: Option<Duration>,
)
pub fn log_response<B>( &self, response: &Response<B>, request_info: &RequestInfo, upstream_duration: Option<Duration>, )
Log the response with timing information
Trait Implementations§
Source§impl Clone for LoggingMiddleware
impl Clone for LoggingMiddleware
Source§fn clone(&self) -> LoggingMiddleware
fn clone(&self) -> LoggingMiddleware
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 LoggingMiddleware
impl RefUnwindSafe for LoggingMiddleware
impl Send for LoggingMiddleware
impl Sync for LoggingMiddleware
impl Unpin for LoggingMiddleware
impl UnwindSafe for LoggingMiddleware
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