com.isti.util.logging
Class IstiConsoleLogger

java.lang.Object
  extended by com.isti.util.logging.AbstractIstiLogger
      extended by com.isti.util.logging.IstiConsoleLogger
All Implemented Interfaces:
IstiLogger
Direct Known Subclasses:
LogFile

public class IstiConsoleLogger
extends AbstractIstiLogger

Class MessageLogger defines an ISTI console logger. Alternatively a different output stream may be used rather than the console by using the 'out' parameter on the constructor or by calling the 'setConsoleOutput()' method. For a GUI program a 'com.isti.util.gui.TextAreaOutputStream' may be used.


Field Summary
 
Fields inherited from interface com.isti.util.logging.IstiLogger
ALL_MSGS, ALL_MSGS_STR, DEBUG, DEBUG_STR, DEBUG2, DEBUG2_STR, DEBUG3, DEBUG3_STR, DEBUG4, DEBUG4_STR, DEBUG5, DEBUG5_STR, ERROR, ERROR_STR, INFO, INFO_STR, NO_MSGS, NO_MSGS_STR, WARNING, WARNING_STR
 
Constructor Summary
IstiConsoleLogger()
          Creates the console logger.
IstiConsoleLogger(int level)
          Creates the console logger.
 
Method Summary
 int getConsoleLevel()
          Gets the current level for console output messages.
 java.io.PrintStream getConsoleOutput()
          Get the console output stream.
 int getMinLevel()
          Get the minimum level for all output messages.
protected  boolean logMessage(int level, java.lang.String str, java.lang.Throwable t)
          Sends the given string to the log file.
 void setConsoleLevel(int level)
          Sets the current level for console output messages.
 void setConsoleOutput(java.io.OutputStream out)
          Set the console output stream.
 
Methods inherited from class com.isti.util.logging.AbstractIstiLogger
debug, debug2, debug3, debug4, debug5, error, error, getLevelString, getLevelStringNull, getMessage, getMessage, getMessage, info, isLoggable, levelStringToValue, println, println, println, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IstiConsoleLogger

public IstiConsoleLogger()
Creates the console logger.


IstiConsoleLogger

public IstiConsoleLogger(int level)
Creates the console logger.

Parameters:
level - the console level to be used.
Method Detail

getConsoleLevel

public int getConsoleLevel()
Gets the current level for console output messages. (See the 'consoleLevel' parameter on the constructor.)

Returns:
the current level for console output messages

getMinLevel

public int getMinLevel()
Get the minimum level for all output messages.

Overrides:
getMinLevel in class AbstractIstiLogger
Returns:
the minimum level for all output messages.
See Also:
AbstractIstiLogger.isLoggable(int)

getConsoleOutput

public java.io.PrintStream getConsoleOutput()
Get the console output stream.

Returns:
the console output stream.

setConsoleLevel

public void setConsoleLevel(int level)
Sets the current level for console output messages. (See the 'consoleLevel' parameter on the constructor.)

Parameters:
level - the console level to be used.

setConsoleOutput

public void setConsoleOutput(java.io.OutputStream out)
Set the console output stream.

Parameters:
out - the console output stream.

logMessage

protected boolean logMessage(int level,
                             java.lang.String str,
                             java.lang.Throwable t)
Sends the given string to the log file. (And possibly the console--see the 'consoleLevel' parameter on the constructor.)

Specified by:
logMessage in class AbstractIstiLogger
Parameters:
level - the message level to be used, or NO_LEVEL for none.
str - the string to be outputted.
t - Throwable associated with a log message or null if none.
Returns:
true if successful, false if an I/O error was detected.
See Also:
AbstractIstiLogger.getMessage(String, Throwable)