pub struct Redactor { /* private fields */ }Expand description
Replaces known secret values in a string with [REDACTED].
Implementations§
Source§impl Redactor
impl Redactor
Sourcepub fn add_secret(&mut self, value: &str, min_len: usize)
pub fn add_secret(&mut self, value: &str, min_len: usize)
Records a secret value when it is at least min_len characters
long (and non-empty). Explicit extras pass min_len 0 so they
always apply.
Sourcepub fn add_secret_values(&mut self, values: impl IntoIterator<Item = String>)
pub fn add_secret_values(&mut self, values: impl IntoIterator<Item = String>)
Records config-derived secrets, applying [MIN_SECRET_LEN].
Sourcepub const fn is_empty(&self) -> bool
pub const fn is_empty(&self) -> bool
Whether no local secrets are registered (runtime-observed secrets may still apply).
Sourcepub fn redact(&self, input: &str) -> String
pub fn redact(&self, input: &str) -> String
Replaces every occurrence of every registered secret (local list
first, then the process-global observed-secret registry) with
[REDACTED]. Infallible: a broken registry can never fail an emit.
Sourcepub fn redact_event(&self, event: &TestEvent) -> TestEvent
pub fn redact_event(&self, event: &TestEvent) -> TestEvent
Returns a copy of the event with every String field redacted;
numeric/enum fields are copied verbatim.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Redactor
impl RefUnwindSafe for Redactor
impl Send for Redactor
impl Sync for Redactor
impl Unpin for Redactor
impl UnsafeUnpin for Redactor
impl UnwindSafe for Redactor
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