heurgame.logging
Class LogBox

java.lang.Object
  extended byheurgame.logging.LogBox
All Implemented Interfaces:
LogWriter

public class LogBox
extends java.lang.Object
implements LogWriter

Author:
David Kaplin I found myself duplicating a lot of code when I was creating loggable components. This class simplifies the use of logging aspsect of the framework.

Constructor Summary
LogBox(java.lang.String name)
           
LogBox(java.lang.String name, AbstractLog conduit, LogReader output)
           
LogBox(java.lang.String name, LogReader output)
           
 
Method Summary
 void addEntry(java.lang.String shortDescription, java.lang.String longDescription)
           
 void addUrgentEntry(java.lang.String shortDescription, java.lang.String longDescription, int priority)
           
 java.util.List getEntries()
          This is the normal method for adding information to the log.
 java.lang.String getLogName()
          Usually a particular LogWriter is going to send more than one message to the log during the life of a program.
 java.util.List urgentEntries()
          Normally logs are stored in a FIFO manner.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogBox

public LogBox(java.lang.String name)

LogBox

public LogBox(java.lang.String name,
              LogReader output)

LogBox

public LogBox(java.lang.String name,
              AbstractLog conduit,
              LogReader output)
Method Detail

addEntry

public void addEntry(java.lang.String shortDescription,
                     java.lang.String longDescription)

addUrgentEntry

public void addUrgentEntry(java.lang.String shortDescription,
                           java.lang.String longDescription,
                           int priority)

getLogName

public java.lang.String getLogName()
Description copied from interface: LogWriter
Usually a particular LogWriter is going to send more than one message to the log during the life of a program. To avoid constantly sending the sender's name during updates a LogWriter should identify itself through this message.

Specified by:
getLogName in interface LogWriter
Returns:
Descriptive name of the reporting component.
See Also:
LogWriter.getLogName()

getEntries

public java.util.List getEntries()
Description copied from interface: LogWriter
This is the normal method for adding information to the log.

Specified by:
getEntries in interface LogWriter
See Also:
LogWriter.getEntries()

urgentEntries

public java.util.List urgentEntries()
Description copied from interface: LogWriter
Normally logs are stored in a FIFO manner. Using this method will give your message the opportunity to reach the highest point in the log.

Specified by:
urgentEntries in interface LogWriter
Returns:
A List of urgent entires for the log
See Also:
LogWriter.urgentEntries()