pub struct MLLoggingConfig {
pub enabled: bool,
pub sample_rate: f64,
pub hash_keys: bool,
pub target: String,
}Expand description
Configuration for ML-ready structured logging.
Fields§
§enabled: boolEnable ML-ready structured logging
sample_rate: f64Sample rate (1.0 = all requests, 0.1 = 10%)
hash_keys: boolHash cache keys for privacy (recommended for production)
target: StringTarget for structured logs (defaults to “tower_http_cache::ml”)
Implementations§
Source§impl MLLoggingConfig
impl MLLoggingConfig
Sourcepub fn with_enabled(self, enabled: bool) -> Self
pub fn with_enabled(self, enabled: bool) -> Self
Enables ML logging.
Sourcepub fn with_sample_rate(self, rate: f64) -> Self
pub fn with_sample_rate(self, rate: f64) -> Self
Sets the sample rate (0.0 to 1.0).
Sourcepub fn with_hash_keys(self, hash: bool) -> Self
pub fn with_hash_keys(self, hash: bool) -> Self
Enables or disables key hashing.
Sourcepub fn with_target(self, target: impl Into<String>) -> Self
pub fn with_target(self, target: impl Into<String>) -> Self
Sets a custom logging target.
Sourcepub fn should_sample(&self) -> bool
pub fn should_sample(&self) -> bool
Checks if this request should be logged based on sampling rate.
Trait Implementations§
Source§impl Clone for MLLoggingConfig
impl Clone for MLLoggingConfig
Source§fn clone(&self) -> MLLoggingConfig
fn clone(&self) -> MLLoggingConfig
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 MLLoggingConfig
impl Debug for MLLoggingConfig
Auto Trait Implementations§
impl Freeze for MLLoggingConfig
impl RefUnwindSafe for MLLoggingConfig
impl Send for MLLoggingConfig
impl Sync for MLLoggingConfig
impl Unpin for MLLoggingConfig
impl UnwindSafe for MLLoggingConfig
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