kiwi.util
Class LoggingMux

java.lang.Object
  extended bykiwi.util.LoggingMux
All Implemented Interfaces:
LoggingEndpoint

public class LoggingMux
extends java.lang.Object
implements LoggingEndpoint

A logging multiplexor. This class manages a set of LoggingEndpoints and itself implements the LoggingEndpoint interface. It may be use to direct logging messages to several endpoints simultaneously. For example, an application may send messages to both a console and a file.

Author:
Mark Lindner, PING Software Group
See Also:
LoggingEndpoint

Field Summary
private  java.util.Vector v
           
 
Fields inherited from interface kiwi.util.LoggingEndpoint
ERROR, INFO, STATUS, WARNING
 
Constructor Summary
LoggingMux()
          Construct a new LoggingMux.
 
Method Summary
 void addLoggingEndpoint(LoggingEndpoint endpoint)
          Add a LoggingEndpoint to the set.
 void close()
          Close this set of endpoints.
 void close(boolean closeEndpoints)
          Close this set of endpoints.
 void logMessage(int type, java.lang.String message)
          Log a message to all endpoints in this set.
 void removeAllLoggingEndpoints()
          Remove all LoggingEndpoints from the set.
 void removeLoggingEndpoint(LoggingEndpoint endpoint)
          Remove a LoggingEndpoint from the set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

v

private java.util.Vector v
Constructor Detail

LoggingMux

public LoggingMux()
Construct a new LoggingMux.

Method Detail

logMessage

public void logMessage(int type,
                       java.lang.String message)
Log a message to all endpoints in this set.

Specified by:
logMessage in interface LoggingEndpoint
Parameters:
type - The message type; one of the static constants defined above.
message - The message.

close

public void close()
Close this set of endpoints. Equivalent to close(false).

Specified by:
close in interface LoggingEndpoint

close

public void close(boolean closeEndpoints)
Close this set of endpoints.

Parameters:
closeEndpoints - If true, in addition to removing every LoggingEndpoint from its list, the LoggingMux closes each LoggingEndpoint explicitly via a call to its close() method.

addLoggingEndpoint

public void addLoggingEndpoint(LoggingEndpoint endpoint)
Add a LoggingEndpoint to the set.

Parameters:
endpoint - The LoggingEndpoint to add.

removeLoggingEndpoint

public void removeLoggingEndpoint(LoggingEndpoint endpoint)
Remove a LoggingEndpoint from the set.

Parameters:
endpoint - The LoggingEndpoint to remove.

removeAllLoggingEndpoints

public void removeAllLoggingEndpoints()
Remove all LoggingEndpoints from the set.