edu.rice.cs.plt.debug
Class IndentedTextLogSink

java.lang.Object
  extended by edu.rice.cs.plt.debug.TextLogSink
      extended by edu.rice.cs.plt.debug.IndentedTextLogSink
All Implemented Interfaces:
LogSink, Closeable
Direct Known Subclasses:
FileLogSink, OutputStreamLogSink, SystemErrLogSink, SystemOutLogSink, WriterLogSink

public abstract class IndentedTextLogSink
extends TextLogSink

An abstract log that records messages as indented text. Subclasses are responsible for providing a BufferedWriter as needed via writer(edu.rice.cs.plt.debug.LogSink.Message).


Nested Class Summary
 
Nested classes/interfaces inherited from interface edu.rice.cs.plt.debug.LogSink
LogSink.EndMessage, LogSink.ErrorMessage, LogSink.Message, LogSink.MessageVisitor<T>, LogSink.StackMessage, LogSink.StandardMessage, LogSink.StartMessage, LogSink.ValueMessage
 
Constructor Summary
protected IndentedTextLogSink()
           
protected IndentedTextLogSink(int idealLineWidth)
           
 
Method Summary
protected  void write(LogSink.Message m, SizedIterable<String> text)
          Record the given message, the body of which is described by the given lines of text.
protected  void writeEnd(LogSink.EndMessage m, SizedIterable<String> text)
          Record the given end message, the body of which is described by the given lines of text.
protected abstract  BufferedWriter writer(LogSink.Message m)
          Get a BufferedWriter for outputting the given message.
protected  void writeStart(LogSink.StartMessage m, SizedIterable<String> text)
          Record the given start message, the body of which is described by the given lines of text.
 
Methods inherited from class edu.rice.cs.plt.debug.TextLogSink
formatLocation, formatLocation, formatThread, formatTime, log, logEnd, logError, logStack, logStart
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.io.Closeable
close
 

Constructor Detail

IndentedTextLogSink

protected IndentedTextLogSink()

IndentedTextLogSink

protected IndentedTextLogSink(int idealLineWidth)
Method Detail

writer

protected abstract BufferedWriter writer(LogSink.Message m)
Get a BufferedWriter for outputting the given message.


write

protected void write(LogSink.Message m,
                     SizedIterable<String> text)
Description copied from class: TextLogSink
Record the given message, the body of which is described by the given lines of text. Subclasses should ensure that the effects of this method appear to be atomic (at least within the context of concurrent invocations of this method). This can be trivially achieved by declaring the method synchronized.

Specified by:
write in class TextLogSink

writeStart

protected void writeStart(LogSink.StartMessage m,
                          SizedIterable<String> text)
Description copied from class: TextLogSink
Record the given start message, the body of which is described by the given lines of text. Subclasses should ensure that the effects of this method appear to be atomic (at least within the context of concurrent invocations of this method). This can be trivially achieved by declaring the method synchronized.

Specified by:
writeStart in class TextLogSink

writeEnd

protected void writeEnd(LogSink.EndMessage m,
                        SizedIterable<String> text)
Description copied from class: TextLogSink
Record the given end message, the body of which is described by the given lines of text. Subclasses should ensure that the effects of this method appear to be atomic (at least within the context of concurrent invocations of this method). This can be trivially achieved by declaring the method synchronized.

Specified by:
writeEnd in class TextLogSink