View Javadoc
1 /* 2 * Debug.java 3 * 4 * $Id: Debug.java,v 1.3 2004/02/06 12:22:36 baliuka Exp $ 5 */ 6 7 package net.sf.voruta; 8 9 import java.io.*; 10 11 /*** 12 * 13 * @author baliuka 14 */ 15 public class Debug implements Log{ 16 17 PrintStream out; 18 19 /*** Creates a new instance of Debug */ 20 public Debug() { 21 this(System.err); 22 } 23 24 /*** Creates a new instance of Debug */ 25 public Debug(PrintStream out) { 26 this.out = out; 27 } 28 29 30 /*** prints debug 31 * @param str debug info 32 */ 33 public void debug(Object str) { 34 print( " DEBUG " + str); 35 } 36 37 /*** prints info 38 * @param str info 39 * 40 */ 41 public void info(Object str) { 42 print( " INFO " + str); 43 } 44 45 46 /*** prints warning 47 * @param str info 48 * 49 */ 50 public void warn(Object str) { 51 print(" WARN " + str); 52 } 53 54 void printObject(Object obj){ 55 out.println( Thread.currentThread().getName() + " " + obj); 56 } 57 void print(Object obj){ 58 59 if(obj != null && obj instanceof Throwable){ 60 61 printObject(obj); 62 ((Throwable) obj).printStackTrace(out); 63 64 }else{ 65 66 printObject(obj); 67 68 } 69 70 } 71 }

This page was automatically generated by Maven