pub trait RedactPolicy {
// Provided methods
fn redact_key(&self, _key: &str) -> bool { ... }
fn redact_value(&self, _key: Option<&str>, value: &str) -> Option<String> { ... }
}Expand description
Policy for redacting sensitive data from error output.
§Example
use orion_error::report::RedactPolicy;
struct HideTokens;
impl RedactPolicy for HideTokens {
fn redact_key(&self, key: &str) -> bool {
key.contains("token") || key.contains("secret")
}
fn redact_value(&self, key: Option<&str>, value: &str) -> Option<String> {
match key {
Some("detail") | Some("source.message") => {
Some(value.replace("token=", "token=<redacted>"))
}
_ => Some(value.to_string()),
}
}
}redact_keyreturnstrueto drop the entire entry.redact_valuetransforms or replaces individual values. ReturnNoneto drop the entry,Some(...)to replace it.