Class Logs


  • public final class Logs
    extends Object
    Helper class for logging securely sensitive values.
    • Method Detail

      • logResolution

        public static Consumer<String> logResolution​(org.slf4j.Logger logger,
                                                     PropertyResolver resolver,
                                                     String key,
                                                     boolean sensitive)
        Securely logs resolved value on the given logger. If sensitive is true, a original value's hashcode is printed, otherwise the real value is printed.

        Example usage:

             
             value.ifPresent(logResolution(logger, this, key, sensitive));
             
         
        Parameters:
        logger - Logger to use
        resolver - property resolver that has performed the resolution
        key - Name of the property.
        sensitive - Should the value be masked or not
        Returns:
        a function to be used in Optional.ifPresent(Consumer)
        See Also:
        System.identityHashCode(Object)