Skip to content

Provide alternate UnsafeArg factory that takes Supplier<T> #8

@gracew

Description

@gracew

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions