Struct gotham::middleware::logger::SimpleLogger
source · pub struct SimpleLogger { /* private fields */ }
Expand description
A struct that can act as a simple 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 SimpleLogger
impl Clone for SimpleLogger
source§fn clone(&self) -> SimpleLogger
fn clone(&self) -> SimpleLogger
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 SimpleLogger
impl Middleware for SimpleLogger
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 SimpleLogger
impl NewMiddleware for SimpleLogger
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 = SimpleLogger
type Instance = SimpleLogger
The type of
Middleware
created by the NewMiddleware
.