pub fn custom_request_replace(
        mut self,
        label: &str,
        f: impl Fn(&Request<State>) -> String + Send + Sync + 'static,
    ) -> Self {
        let inner = Arc::get_mut(&mut self.inner).unwrap();

        let ft = inner.format.0.iter_mut().find(
            |ft| matches!(ft, FormatText::CustomRequest(unit_label, _) if label == unit_label),
        );

        if let Some(FormatText::CustomRequest(_, request_fn)) = ft {
            // replace into None or previously registered fn using same label
            request_fn.replace(CustomRequestFn {
                inner_fn: Arc::new(f),
            });
        } else {
            // non-printed request replacement function diagnostic
            error!(
                "Attempted to register custom request logging function for nonexistent label: {}",
                label
            );
        }

        self
    }
/// Register a function that receives a Request and returns a String for use in the
/// log line. The label passed as the first argument should match a replacement substring in
/// the logger format like `%{label}xi`.
///
/// It is convention to print "-" to indicate no output instead of an empty string.
Register a function that receives a Request and returns a String for use in the
log line. The label passed as the first argument should match a replacement substring in
the logger format like `%{label}xi`.

It is convention to print "-" to indicate no output instead of an empty string.
Register a function that receives a Request and returns a String for use in the log line . The label passed as the first argument should match a replacement substring in the logger format like ` % { label } xi ` . It is convention to print " - " to indicate no output instead of an empty string .
pub fn custom_request_replace(
        mut self,
        label: &str,
        f: impl Fn(&Request<State>) -> String + Send + Sync + 'static,
    ) -> Self {
        let inner = Arc::get_mut(&mut self.inner).unwrap();
        let ft = inner.format.0.iter_mut().find(
            |ft| matches!(ft, FormatText::CustomRequest(unit_label, _) if label == unit_label),
        );
        if let Some(FormatText::CustomRequest(_, request_fn)) = ft {
            // replace into None or previously registered fn using same label
            request_fn.replace(CustomRequestFn {
                inner_fn: Arc::new(f),
            });
        } else {
            // non-printed request replacement function diagnostic
            error!(
                "Attempted to register custom request logging function for nonexistent label: {}",
                label
            );
        }
        self
    }
pub fn custom_request_replace ( mut self , label : & str , f : impl Fn ( & Request < State > ) -> String + Send + Sync + ' static , ) -> Self { let inner = Arc :: get_mut ( & mut self . inner ) . unwrap ( ) ; let ft = inner . format . 0 . iter_mut ( ) . find ( | ft | matches ! ( ft FormatText CustomRequest ( unit_label ) if label unit_label ) , ) ; if let Some ( FormatText :: CustomRequest ( _ , request_fn ) ) = ft { // replace into None or previously registered fn using same label request_fn . replace ( CustomRequestFn { inner_fn : Arc :: new ( f ) , } ) ; } else { // non-printed request replacement function diagnostic error ! ( " " label ) ; } self }
Register a function that receives a Request and returns a String for use in the
log line.
Register a function that receives a Request and returns a String for use in the log line .
mut self
label
&str
f
impl Fn(&Request<State>) -> String + Send + Sync + 'static
mut self
label
&str
f
impl Fn(&Request<State>) -> String + Send + Sync + 'static