pub struct RequestLogger { /* private fields */ }Expand description
Request/response logger with credential redaction
Implementations§
Source§impl RequestLogger
impl RequestLogger
pub fn new(config: LoggingConfig) -> Self
Sourcepub fn log_request(
&self,
method: &str,
url: &str,
headers: &[(&str, &str)],
body: &[u8],
)
pub fn log_request( &self, method: &str, url: &str, headers: &[(&str, &str)], body: &[u8], )
Log outgoing request
Sourcepub fn log_response(
&self,
status: u16,
headers: &[(&str, &str)],
body: &[u8],
duration: Duration,
)
pub fn log_response( &self, status: u16, headers: &[(&str, &str)], body: &[u8], duration: Duration, )
Log incoming response
Sourcepub fn log_error(
&self,
method: &str,
url: &str,
error: &str,
duration: Duration,
)
pub fn log_error( &self, method: &str, url: &str, error: &str, duration: Duration, )
Log request error with timing information
Sourcepub fn redact_headers(&self, headers: &[(&str, &str)]) -> Vec<(String, String)>
pub fn redact_headers(&self, headers: &[(&str, &str)]) -> Vec<(String, String)>
Redact sensitive headers
Sourcepub fn redact_body(&self, body: &[u8]) -> String
pub fn redact_body(&self, body: &[u8]) -> String
Redact request/response body
Sourcepub fn redact_credential(&self, value: &str) -> String
pub fn redact_credential(&self, value: &str) -> String
Redact credential values
Auto Trait Implementations§
impl Freeze for RequestLogger
impl RefUnwindSafe for RequestLogger
impl Send for RequestLogger
impl Sync for RequestLogger
impl Unpin for RequestLogger
impl UnwindSafe for RequestLogger
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