sanitize Header
Redacts headers whose name satisfies predicate from log output.
Can be called multiple times to register several predicates — a header is redacted if any predicate returns true. The Authorization header is always redacted regardless of the configured predicates.
Example:
logging {
level = LogLevel.BODY
sanitizeHeader { it.equals("Cookie", ignoreCase = true) }
sanitizeHeader { it.startsWith("X-Secret-", ignoreCase = true) }
}Content copied to clipboard
Parameters
predicate
Returns true to redact the header with the given name