Struct gotham::middleware::logger::RequestLogger
source · pub struct RequestLogger { /* private fields */ }
Expand description
A struct that can act as a logging middleware for Gotham.
We implement NewMiddleware
here for Gotham to allow us to work with the request
lifecycle correctly. This trait requires Clone
, so that is also included.
Implementations§
Trait Implementations§
source§impl Clone for RequestLogger
impl Clone for RequestLogger
source§fn clone(&self) -> RequestLogger
fn clone(&self) -> RequestLogger
Returns a copy 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 moresource§impl Middleware for RequestLogger
impl Middleware for RequestLogger
Implementing gotham::middleware::Middleware
allows us to hook into the request chain
in order to correctly log out after a request has executed.
source§impl NewMiddleware for RequestLogger
impl NewMiddleware for RequestLogger
Implementation of NewMiddleware
is required for Gotham middleware.
This will simply dereference the internal state, rather than deriving NewMiddleware
which will clone the structure - should be cheaper for repeated calls.
source§fn new_middleware(&self) -> Result<Self::Instance>
fn new_middleware(&self) -> Result<Self::Instance>
Returns a new middleware to be used to serve a request.
§type Instance = RequestLogger
type Instance = RequestLogger
The type of
Middleware
created by the NewMiddleware
.