[logback-dev] svn commit: r979 - in logback/trunk/logback-core/src/main/java/ch/qos/logback/core: joran/spi util
noreply.ceki at qos.ch
noreply.ceki at qos.ch
Wed Nov 22 08:03:03 CET 2006
Author: ceki
Date: Wed Nov 22 08:03:02 2006
New Revision: 979
Modified:
logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/spi/InterpretationContext.java
logback/trunk/logback-core/src/main/java/ch/qos/logback/core/util/Duration.java
Log:
- In InterpretationContext substitution properties to be added by Map<String,String>
- Improved toString in Duration
Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/spi/InterpretationContext.java
==============================================================================
--- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/spi/InterpretationContext.java (original)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/spi/InterpretationContext.java Wed Nov 22 08:03:02 2006
@@ -125,6 +125,19 @@
}
}
+ public void addSubstitutionProperties(Map<String, String> propertyMap) {
+ if (propertyMap == null) {
+ return;
+ }
+ Iterator i = propertyMap.keySet().iterator();
+ while (i.hasNext()) {
+ String key = (String) i.next();
+ addSubstitutionProperty(key, propertyMap.get(key));
+ }
+ }
+
+
+
public String getSubstitutionProperty(String key) {
return substitutionMap.get(key);
}
Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/util/Duration.java
==============================================================================
--- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/util/Duration.java (original)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/util/Duration.java Wed Nov 22 08:03:02 2006
@@ -100,6 +100,19 @@
throw new IllegalArgumentException("String value [" + durationStr
+ "] is not in the expected format.");
}
-
+ }
+
+ @Override
+ public String toString() {
+ if(millis < SECONDS_COEFFICIENT) {
+ return millis + " milliseconds";
+ } else if (millis < MINUTES_COEFFICIENT){
+ return millis/SECONDS_COEFFICIENT +" seconds";
+ } else if(millis < HOURS_COEFFICIENT) {
+ return millis/MINUTES_COEFFICIENT +" minutes";
+ } else {
+ return millis/HOURS_COEFFICIENT+" hours";
+ }
+
}
}
More information about the logback-dev
mailing list