ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant DefaultLogger.java
Date Tue, 11 Dec 2001 15:06:23 GMT
bodewig     01/12/11 07:06:23

  Modified:    src/main/org/apache/tools/ant DefaultLogger.java
  Log:
  simplify DefaultLogger
  
  Revision  Changes    Path
  1.22      +13 -14    jakarta-ant/src/main/org/apache/tools/ant/DefaultLogger.java
  
  Index: DefaultLogger.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/DefaultLogger.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- DefaultLogger.java	2001/12/11 12:01:51	1.21
  +++ DefaultLogger.java	2001/12/11 15:06:23	1.22
  @@ -99,7 +99,7 @@
        * @param output the output stream for the logger.
        */
       public void setOutputPrintStream(PrintStream output) {
  -        this.out = output;
  +        this.out = new PrintStream(output, true);
       }
   
       /**
  @@ -108,7 +108,7 @@
        * @param err the error stream for the logger.
        */
       public void setErrorPrintStream(PrintStream err) {
  -        this.err = err;
  +        this.err = new PrintStream(err, true);
       }
   
       /**
  @@ -160,14 +160,18 @@
                          + formatTime(System.currentTimeMillis() - startTime));
   
           String msg = message.toString();
  -        printlnAndFlush(error == null ? out : err, msg);
  +        if (error == null) {
  +            out.println(msg);
  +        } else {
  +            err.println(msg);
  +        }
           log(msg);
       }
   
       public void targetStarted(BuildEvent event) {
           if (Project.MSG_INFO <= msgOutputLevel) {
               String msg = lSep + event.getTarget().getName() + ":";
  -            printlnAndFlush(out, msg);
  +            out.println(msg);
               log(msg);
           }
       }
  @@ -198,8 +202,11 @@
   
               message.append(event.getMessage());
               String msg = message.toString();
  -            printlnAndFlush(event.getPriority() != Project.MSG_ERR ? out : err,
  -                            msg);
  +            if (event.getPriority() != Project.MSG_ERR) {
  +                out.println(msg);
  +            } else {
  +                err.println(msg);
  +            }
               log(msg);
           }
       }
  @@ -227,13 +234,5 @@
        * same output that is generated here.
        */
       protected void log(String message) {}
  -
  -    /**
  -     * Print a line to the given stream and flush the stream right after that.
  -     */
  -    protected void printlnAndFlush(PrintStream p, String line) {
  -        p.println(line);
  -        p.flush();
  -    }
   
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message