pub struct HttpLoggingOptions {
pub enabled: bool,
pub log_request_header: bool,
pub log_request_body: bool,
pub log_response_header: bool,
pub log_response_body: bool,
pub body_size_limit: usize,
}Expand description
Controls TRACE-level HTTP request/response logging in crate::HttpLogger.
Fields§
§enabled: boolWhether logging is enabled.
log_request_header: boolWhether request headers are logged.
log_request_body: boolWhether request body is logged.
log_response_header: boolWhether response headers are logged.
log_response_body: boolWhether response body is logged.
body_size_limit: usizeMaximum body bytes to print in logs.
Implementations§
Source§impl HttpLoggingOptions
impl HttpLoggingOptions
Sourcepub fn from_config<R>(config: &R) -> Result<Self, HttpConfigError>where
R: ConfigReader + ?Sized,
pub fn from_config<R>(config: &R) -> Result<Self, HttpConfigError>where
R: ConfigReader + ?Sized,
Reads logging settings from config using relative keys.
§Parameters
config: AnyConfigReader(e.g.config.prefix_view("logging")).
Keys read (all optional; missing keys keep their defaults):
enabledlog_request_headerlog_request_bodylog_response_headerlog_response_bodybody_size_limit
§Returns
Populated HttpLoggingOptions or HttpConfigError.
Sourcepub fn validate(&self) -> Result<(), HttpConfigError>
pub fn validate(&self) -> Result<(), HttpConfigError>
Ensures body_size_limit is non-zero when any body logging flag is enabled.
§Returns
Ok(()) or HttpConfigError::invalid_value for logging.body_size_limit.
Trait Implementations§
Source§impl Clone for HttpLoggingOptions
impl Clone for HttpLoggingOptions
Source§fn clone(&self) -> HttpLoggingOptions
fn clone(&self) -> HttpLoggingOptions
Returns a duplicate 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 Debug for HttpLoggingOptions
impl Debug for HttpLoggingOptions
Source§impl Default for HttpLoggingOptions
impl Default for HttpLoggingOptions
Source§fn default() -> Self
fn default() -> Self
Enables logging of headers and bodies; body preview size is
crate::constants::DEFAULT_LOG_BODY_SIZE_LIMIT_BYTES.
§Returns
Default HttpLoggingOptions.
Source§impl PartialEq for HttpLoggingOptions
impl PartialEq for HttpLoggingOptions
impl Eq for HttpLoggingOptions
impl StructuralPartialEq for HttpLoggingOptions
Auto Trait Implementations§
impl Freeze for HttpLoggingOptions
impl RefUnwindSafe for HttpLoggingOptions
impl Send for HttpLoggingOptions
impl Sync for HttpLoggingOptions
impl Unpin for HttpLoggingOptions
impl UnsafeUnpin for HttpLoggingOptions
impl UnwindSafe for HttpLoggingOptions
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.