1 21 22 package org.apache.derby.impl.services.stream; 23 24 import org.apache.derby.iapi.services.stream.PrintWriterGetHeader; 25 import org.apache.derby.iapi.util.CheapDateFormatter; 26 27 34 35 class BasicGetLogHeader implements PrintWriterGetHeader 36 { 37 38 private boolean doThreadId; 39 private boolean doTimeStamp; 40 private String tag; 41 42 48 59 BasicGetLogHeader(boolean doThreadId, 60 boolean doTimeStamp, 61 String tag){ 62 this.doThreadId = doThreadId; 63 this.doTimeStamp = doTimeStamp; 64 this.tag = tag; 65 } 66 67 public String getHeader() 68 { 69 StringBuffer header = new StringBuffer (48); 70 71 if (tag != null) { 72 header.append(tag); 73 header.append(' '); 74 } 75 76 if (doTimeStamp) { 77 long currentTime = System.currentTimeMillis(); 78 79 header.append(CheapDateFormatter.formatDate(currentTime)); 80 header.append(' '); 81 82 } 83 if (doThreadId) { 84 header.append(Thread.currentThread().toString()); 85 header.append(' '); 86 } 87 88 return header.toString(); 89 } 90 } 91 92 | Popular Tags |