1 24 package org.objectweb.jalisto.se.impl.trace; 25 26 import java.io.PrintWriter ; 27 28 public class TracePrintWriter extends TraceImpl { 29 private PrintWriter logger; 30 31 protected String getTraceType() { 32 return "TracePrintWritter"; 33 } 34 35 public TracePrintWriter(TraceContext context, Trace current, PrintWriter printWriter) { 36 super(context); 37 setEnabledModules(current.enabledModules()); 38 logger = printWriter; 39 } 40 41 public TracePrintWriter(TraceContext context, PrintWriter printWriter) { 42 super(context); 43 logger = printWriter; 44 } 45 46 public void printException(Object message, Throwable t) { 47 print(TRACE_ON, String.valueOf(message)); 48 t.printStackTrace(logger); 49 } 50 51 protected void print(Module module, String message) { 52 logger.print(pad(module)); 53 54 if (isShowThread()) { 55 logger.print(" {" + Thread.currentThread() + "}"); 56 } 57 58 logger.println(" " + message); 59 logger.flush(); 60 } 61 62 static final long serialVersionUID = -7589377097964761000L; 63 } 64 | Popular Tags |