1 18 19 package org.apache.tools.ant.taskdefs; 20 21 import java.io.IOException ; 22 23 import org.apache.tools.ant.Project; 24 import org.apache.tools.ant.ProjectComponent; 25 import org.apache.tools.ant.Task; 26 import org.apache.tools.ant.util.LineOrientedOutputStream; 27 28 35 public class LogOutputStream extends LineOrientedOutputStream { 36 37 private ProjectComponent pc; 38 private int level = Project.MSG_INFO; 39 40 46 public LogOutputStream(Task task, int level) { 47 this((ProjectComponent) task, level); 48 } 49 50 57 public LogOutputStream(ProjectComponent pc, int level) { 58 this.pc = pc; 59 this.level = level; 60 } 61 62 65 protected void processBuffer() { 66 try { 67 super.processBuffer(); 68 } catch (IOException e) { 69 throw new RuntimeException ("Impossible IOException caught: " + e); 71 } 72 } 73 74 79 protected void processLine(String line) { 80 processLine(line, level); 81 } 82 83 89 protected void processLine(String line, int level) { 90 pc.log(line, level); 91 } 92 93 97 public int getMessageLevel() { 98 return level; 99 } 100 101 } 102 | Popular Tags |