tabs instead of spaces, checking for log level

This commit is contained in:
Florian Hopf
2018-02-27 11:01:15 +08:00
parent c29eb7f7e3
commit 94d9b39b42

View File

@@ -138,24 +138,26 @@ public class ConfigServicePropertySourceLocator implements PropertySourceLocator
}
private void log(Environment result) {
logger.info(String.format("Located environment: name=%s, profiles=%s, label=%s, version=%s, state=%s",
result.getName(),
result.getProfiles() == null ? "" : Arrays.asList(result.getProfiles()),
result.getLabel(), result.getVersion(), result.getState()));
if (logger.isInfoEnabled()) {
logger.info(String.format("Located environment: name=%s, profiles=%s, label=%s, version=%s, state=%s",
result.getName(),
result.getProfiles() == null ? "" : Arrays.asList(result.getProfiles()),
result.getLabel(), result.getVersion(), result.getState()));
}
if (logger.isDebugEnabled()) {
List<PropertySource> propertySourceList = result.getPropertySources();
if (propertySourceList != null) {
int propertyCount = 0;
for (PropertySource propertySource: propertySourceList) {
propertyCount += propertySource.getSource().size();
}
logger.debug(String.format("Environment %s has %d property sources with %d properties.",
result.getName(),
result.getPropertySources().size(),
propertyCount));
}
List<PropertySource> propertySourceList = result.getPropertySources();
if (propertySourceList != null) {
int propertyCount = 0;
for (PropertySource propertySource: propertySourceList) {
propertyCount += propertySource.getSource().size();
}
logger.debug(String.format("Environment %s has %d property sources with %d properties.",
result.getName(),
result.getPropertySources().size(),
propertyCount));
}
}
}
}
private void putValue(HashMap<String, Object> map, String key, String value) {