Skip to main content

Masker

Trait Masker 

Source
pub trait Masker: Send + Sync {
    // Required methods
    fn mask_value<'v>(&self, key: &str, value: &'v str) -> Cow<'v, str>;
    fn mask_output<'v>(&self, line: &'v str) -> Cow<'v, str>;
}
Expand description

Trait for masking sensitive values in log output.

Implement this trait to provide custom masking rules.

Required Methods§

Source

fn mask_value<'v>(&self, key: &str, value: &'v str) -> Cow<'v, str>

Mask a value based on its field key and content.

Returns the original value unchanged if no masking is needed, or a masked version if the value contains sensitive data.

Source

fn mask_output<'v>(&self, line: &'v str) -> Cow<'v, str>

Mask sensitive data in a formatted log output string.

Applies both field-name and value-pattern masking to a complete log line. Used by MaskingMakeWriter to mask output before writing to the underlying writer.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§