pub struct HttpLogger { /* private fields */ }Expand description
A middleware for logging HTTP requests.
Implementations§
Source§impl HttpLogger
impl HttpLogger
Sourcepub fn new<T: HttpLoggerBackend + 'static>(backend: T) -> Self
pub fn new<T: HttpLoggerBackend + 'static>(backend: T) -> Self
Create a new HTTP logger from a backend
Sourcepub fn new_with_locked<T: HttpLoggerBackend + 'static>(
backend: Arc<RwLock<T>>,
) -> Self
pub fn new_with_locked<T: HttpLoggerBackend + 'static>( backend: Arc<RwLock<T>>, ) -> Self
Create a new HTTP logger from a backend that is encapsulated in an Arc<Rwlock<_>>.
This can be used in order to maintain access to the backend inside the RwLock
even after passing it into the HttpLogger.
Sourcepub async fn log_request(
&self,
start_time: SystemTime,
request: &Request<Vec<u8>>,
response: Option<&Response<Bytes>>,
)
pub async fn log_request( &self, start_time: SystemTime, request: &Request<Vec<u8>>, response: Option<&Response<Bytes>>, )
Log a HTTP request.
Trait Implementations§
Source§impl Clone for HttpLogger
impl Clone for HttpLogger
Source§fn clone(&self) -> HttpLogger
fn clone(&self) -> HttpLogger
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 HttpLogger
impl !RefUnwindSafe for HttpLogger
impl !Send for HttpLogger
impl !Sync for HttpLogger
impl Unpin for HttpLogger
impl !UnwindSafe for HttpLogger
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