Coverage Report - net.sf.statsvn.ant.AntTaskLogger
 
Classes in this File Line Coverage Branch Coverage Complexity
AntTaskLogger
0%
0/17
0%
0/12
2
 
 1  
 package net.sf.statsvn.ant;
 2  
 
 3  
 import net.sf.statcvs.output.ConfigurationOptions;
 4  
 import net.sf.statsvn.util.TaskLogger;
 5  
 
 6  
 import org.apache.tools.ant.Task;
 7  
 
 8  
 /**
 9  
  * This class wraps up an Ant task which is going to be used to log some text
 10  
  * when the tool is used with Ant.
 11  
  * 
 12  
  * @author Benoit Xhenseval
 13  
  */
 14  
 public final class AntTaskLogger implements TaskLogger {
 15  
         /** the Ant task. */
 16  
         private final Task task;
 17  
 
 18  0
         private Boolean shouldAcceptLog = null;
 19  
 
 20  0
         private Boolean shouldAcceptInfo = null;
 21  
 
 22  
         /**
 23  
          * Constructor that will hide the specific logging mechanism.
 24  
          * 
 25  
          * @param antTask
 26  
          *            an Ant task
 27  
          */
 28  0
         AntTaskLogger(final Task antTask) {
 29  0
                 this.task = antTask;
 30  0
         }
 31  
 
 32  
         /**
 33  
          * Uses the Ant mechanism to log the text.
 34  
          * 
 35  
          * @param text
 36  
          *            to be logged.
 37  
          */
 38  
         public void log(final String text) {
 39  0
                 if (shouldAcceptLog == null) {
 40  0
                         shouldAcceptLog = Boolean.valueOf(ConfigurationOptions.getLoggingProperties().indexOf("debug") >= 0);
 41  
                 }
 42  0
                 if (shouldAcceptLog.booleanValue()) {
 43  0
                         task.log(text);
 44  
                 }
 45  0
         }
 46  
 
 47  
         /**
 48  
          * Uses the Ant mechanism to log the text.
 49  
          * 
 50  
          * @param text
 51  
          *            to be logged.
 52  
          */
 53  
         public void error(final String arg) {
 54  0
                 log(arg);
 55  0
         }
 56  
 
 57  
         /**
 58  
          * Uses the Ant mechanism to log the text.
 59  
          * 
 60  
          * @param text
 61  
          *            to be logged.
 62  
          */
 63  
         public void info(final String arg) {
 64  0
                 if (shouldAcceptInfo == null) {
 65  0
                         shouldAcceptInfo = Boolean.valueOf(ConfigurationOptions.getLoggingProperties().indexOf("verbose") >= 0);
 66  
                 }
 67  0
                 if (shouldAcceptInfo.booleanValue()) {
 68  0
                         log(arg);
 69  
                 }
 70  0
         }
 71  
 }