private String maskSensitivConfigurationValues(ConfigurationOption<?> configurationOption, String value) { return configurationOption.isSensitive() ? "xxxxxxxxxxx" : value; }
private static String prepareOptionValueForLog(ConfigurationOption<?> option) { if (option.isSensitive()) { return "XXXX"; } else { return option.getValueAsSafeString(); } } }
private void logConfigWithNonDefaultValue(Logger logger, ConfigurationOption<?> option) { logger.debug("{}: '{}' (source: {})", option.getKey(), option.isSensitive() ? "XXXX" : option.getValueAsSafeString(), option.getNameOfCurrentConfigurationSource()); if (option.getTags().contains("deprecated")) { logger.warn("Detected usage of deprecated configuration option '{}'. " + "This option might be removed in the future. " + "Please refer to the documentation about alternatives.", option.getKey()); } if (!option.getKey().equals(option.getUsedKey())) { logger.warn("Detected usage of an old configuration key: '{}'. Please use '{}' instead.", option.getUsedKey(), option.getKey()); } if (option.getValue() instanceof TimeDuration && !TimeDuration.DURATION_PATTERN.matcher(option.getValueAsString()).matches()) { logger.warn("DEPRECATION WARNING: {}: '{}' (source: {}) is not using a time unit. Please use one of 'ms', 's' or 'm'.", option.getKey(), option.getValueAsString(), option.getNameOfCurrentConfigurationSource()); } }