pub struct LoggingHoop { /* private fields */ }Expand description
Access-log middleware. Logs method, path, status, and latency.
Optionally writes structured access logs to a file in addition to the
tracing output. Use LoggingHoop::with_rotating_writer to enable
file output, or LoggingHoop::with_files to write errors to a
separate file.
Implementations§
Source§impl LoggingHoop
impl LoggingHoop
pub fn new() -> Self
pub fn with_rotating_writer( writer: Arc<Mutex<RotatingLogWriter>>, format: Option<String>, ) -> Self
Sourcepub fn with_files(
access_writer: Arc<Mutex<RotatingLogWriter>>,
error_writer: Arc<Mutex<RotatingLogWriter>>,
format: Option<String>,
) -> Self
pub fn with_files( access_writer: Arc<Mutex<RotatingLogWriter>>, error_writer: Arc<Mutex<RotatingLogWriter>>, format: Option<String>, ) -> Self
Create a LoggingHoop with separate access and error log writers.
Trait Implementations§
Source§impl Default for LoggingHoop
impl Default for LoggingHoop
Source§impl Handler for LoggingHoop
impl Handler for LoggingHoop
Source§fn handle<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
req: &'life1 mut Request,
depot: &'life2 mut Depot,
res: &'life3 mut Response,
ctrl: &'life4 mut FlowCtrl,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn handle<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
req: &'life1 mut Request,
depot: &'life2 mut Depot,
res: &'life3 mut Response,
ctrl: &'life4 mut FlowCtrl,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Handle http request.
Source§fn arc(self) -> ArcHandlerwhere
Self: Sized,
fn arc(self) -> ArcHandlerwhere
Self: Sized,
Wrap to
ArcHandler.Source§fn hoop<H>(self, hoop: H) -> HoopedHandler
fn hoop<H>(self, hoop: H) -> HoopedHandler
Hoop this handler with middleware.
Auto Trait Implementations§
impl Freeze for LoggingHoop
impl !RefUnwindSafe for LoggingHoop
impl Send for LoggingHoop
impl Sync for LoggingHoop
impl Unpin for LoggingHoop
impl UnsafeUnpin for LoggingHoop
impl !UnwindSafe for LoggingHoop
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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