We may want to log an object with a sensitive field that should not be logged even under unsafe parameters (e.g. user credentials).
log.info("message", UnsafeArg.of("name", unsafeValue))
Rather than relying on the toString() implementation to remove the offending value, users should instead be able to write:
log.info("message", UnsafeArg.of("name", () -> removeUserCredentials(unsafeValue))
This mostly applies to UnsafeArg, but maybe we could also add to SafeArg for consistency. The more probable scenario with SafeArg is a field that is too large/expensive to log.
We may want to log an object with a sensitive field that should not be logged even under unsafe parameters (e.g. user credentials).
Rather than relying on the
toString()implementation to remove the offending value, users should instead be able to write:This mostly applies to
UnsafeArg, but maybe we could also add toSafeArgfor consistency. The more probable scenario with SafeArg is a field that is too large/expensive to log.