[Dive4elements-commits] [PATCH] Use isDebugEnabled() in S/Q Measurement factory

Wald Commits scm-commit at wald.intevation.org
Wed Jan 23 17:36:25 CET 2013


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1358958978 -3600
# Node ID 97a0fa4dff8e2f6ea1552ddb05b3690896ec959c
# Parent  ad0990a82ab81aa338e6f8b436da989b06c138e4
Use isDebugEnabled() in S/Q Measurement factory.

diff -r ad0990a82ab8 -r 97a0fa4dff8e flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/MeasurementFactory.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/MeasurementFactory.java	Wed Jan 23 17:32:30 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/MeasurementFactory.java	Wed Jan 23 17:36:18 2013 +0100
@@ -371,7 +371,9 @@
 
     protected static Measurement processSameDate(List<Measurement> measurements) {
         int N = measurements.size();
-        if (N > 0) {
+
+        boolean debug = log.isDebugEnabled();
+        if (debug && N > 0) {
             log.debug("process same date for Q: " + measurements.get(0).Q());
         }
         if (N == 1) {
@@ -403,7 +405,9 @@
                     double distNext = next.get("UFERABST");
                     current.set("EFFWIDTH", 0.5*(distNext - distPrev));
                 }
-                log.debug("effective width: " + current.get("EFFWIDTH"));
+                if (debug) {
+                    log.debug("effective width: " + current.get("EFFWIDTH"));
+                }
             }
         }
 
@@ -427,11 +431,13 @@
             sumCoarseF += scale*coarseF;
             sumGravelF += scale*gravelF;
             sumNorm    += scale;
-            log.debug("fractions - s: " +
-                sandF + " c: " +
-                coarseF + " g: " + 
-                gravelF);
-            log.debug("scale: " + scale + " = " + effWidth + " * " + gt);
+            if (debug) {
+                log.debug("fractions - s: " +
+                    sandF + " c: " +
+                    coarseF + " g: " + 
+                    gravelF);
+                log.debug("scale: " + scale + " = " + effWidth + " * " + gt);
+            }
         }
 
         Map<String, Object> data =
@@ -444,7 +450,12 @@
         m.set("BL_S", sumNorm*sumSandF);
         m.set("BL_G", sumNorm*sumGravelF);
         m.set("BL_C", sumNorm*sumCoarseF);
-        log.debug("BL_S: " + m.get("BL_S") + " BL_G: " + m.get("BL_G") + " BL_C: " + m.get("BL_C"));
+        if (debug) {
+            log.debug(
+                "BL_S: " + m.get("BL_S") +
+                " BL_G: " + m.get("BL_G") + 
+                " BL_C: " + m.get("BL_C"));
+        }
         return m;
     }
 


More information about the Dive4elements-commits mailing list