edu.rice.cs.plt.debug
Class SplitLogSink

java.lang.Object
  extended by edu.rice.cs.plt.debug.SplitLogSink
All Implemented Interfaces:
LogSink, Composite, Closeable

public class SplitLogSink
extends Object
implements LogSink, Composite

A log sink that sends messages to all the sinks it contains. This allows, for example, logging to be viewed at runtime while, at the same time, being recorded to a file. The set of sinks can be modified at any time. (Concurrent logging is supported, but concurrent add or remove invocations are not: only one thread should manage the set of sinks at a time.)


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
SplitLogSink(Iterable<? extends LogSink> sinks)
           
SplitLogSink(LogSink... sinks)
          Create a log that will send its messages to each of logs
 
Method Summary
 void add(Iterable<? extends LogSink> toAdd)
           
 void add(LogSink... toAdd)
           
 void close()
           
 int compositeHeight()
          Get the maximum path length from this node to a leaf.
 int compositeSize()
          Get the number of nodes in the tree rooted at this node.
 void log(LogSink.StandardMessage m)
           
 void logEnd(LogSink.EndMessage m)
           
 void logError(LogSink.ErrorMessage m)
           
 void logStack(LogSink.StackMessage m)
           
 void logStart(LogSink.StartMessage m)
           
 void remove(Iterable<? extends LogSink> toRemove)
           
 void remove(LogSink... toRemove)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SplitLogSink

public SplitLogSink(LogSink... sinks)
Create a log that will send its messages to each of logs


SplitLogSink

public SplitLogSink(Iterable<? extends LogSink> sinks)
Method Detail

add

public void add(LogSink... toAdd)

add

public void add(Iterable<? extends LogSink> toAdd)

remove

public void remove(LogSink... toRemove)

remove

public void remove(Iterable<? extends LogSink> toRemove)

compositeHeight

public int compositeHeight()
Description copied from interface: Composite
Get the maximum path length from this node to a leaf.

Specified by:
compositeHeight in interface Composite

compositeSize

public int compositeSize()
Description copied from interface: Composite
Get the number of nodes in the tree rooted at this node. Always 1 or greater.

Specified by:
compositeSize in interface Composite

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Throws:
IOException

log

public void log(LogSink.StandardMessage m)
Specified by:
log in interface LogSink

logStart

public void logStart(LogSink.StartMessage m)
Specified by:
logStart in interface LogSink

logEnd

public void logEnd(LogSink.EndMessage m)
Specified by:
logEnd in interface LogSink

logError

public void logError(LogSink.ErrorMessage m)
Specified by:
logError in interface LogSink

logStack

public void logStack(LogSink.StackMessage m)
Specified by:
logStack in interface LogSink