1 package de.webman.wminstaller.tools; 2 3 import java.io.*; 4 5 8 public class Logger { 9 PrintStream _out = null; 10 11 public Logger () { 12 } 13 14 public Logger (OutputStream stream) 15 throws IOException 16 { 17 if (stream instanceof PrintStream) 18 _out = (PrintStream)stream; 19 else 20 _out = new PrintStream(stream); 21 } 22 23 public Logger (File file) 24 throws IOException 25 { 26 _out = new PrintStream(new FileOutputStream(file)); 27 } 28 29 public Logger (String file) 30 throws IOException 31 { 32 _out = new PrintStream(new FileOutputStream(file)); 33 } 34 35 36 public void close() { 37 if (_out != null) 38 _out.close(); 39 } 40 41 44 public void info(String line) { 45 if (_out != null) 46 _out.println(line); 47 } 48 49 52 public void error(String line) { 53 if (_out != null) 54 _out.println("ERROR: " + line); 55 } 56 } 57 | Popular Tags |