Class Logger

java.lang.Object
  extended by Logger

public class Logger
extends java.lang.Object

Simple logging facility, which displays messages in a console window, and/or appends the messages to a specified log file. The logger determines which messages to display by comparing the level of the message against the level of the Logger object. if the message level is greater than the Logger level, the message is not displayed. The level can be any value, but should be positive or zero for simplicity. Use the lowest message level of zero in messages that must be displayed, such as error messages. Use a higher level for warnings, and higher levels still for debugging messages. You can then control which messages display by using the appropriate Logger level.


Field Summary
private static boolean append
           
private static int level
           
private static java.lang.String logName
           
 
Constructor Summary
Logger()
           
 
Method Summary
static int getLevel()
          Get the logging level.
static void initialize(int _level, java.lang.String _logName)
          This method combines the setLevel and setLogName.
static boolean log(boolean _return, int _level, java.lang.String _message)
          Log the specified message if the specified level is less than or equal to the member level.
static boolean log(boolean _return, int _level, java.lang.String _message, java.lang.Throwable _e)
          Log the specified message if the specified level is less than or equal to the member level.
static boolean log(boolean _return, int _level, java.lang.Throwable _e)
          Log the specified exception and its initial cause(es) if the specified level is less than or equal to the member level.
static void setLevel(int _level)
          Set the logging level.
static void setLogName(java.lang.String _logName)
          Set the name of the file to which to write messages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

append

private static boolean append

level

private static int level

logName

private static java.lang.String logName
Constructor Detail

Logger

public Logger()
Method Detail

setLevel

public static void setLevel(int _level)
Set the logging level.

Parameters:
_level - is the new Logger level.

getLevel

public static int getLevel()
Get the logging level. Use this to determine if you should write debugging files, for example.

Returns:
the current Logging level

setLogName

public static void setLogName(java.lang.String _logName)
Set the name of the file to which to write messages.

Parameters:
_logName - is the name of the logging file.

initialize

public static void initialize(int _level,
                              java.lang.String _logName)
This method combines the setLevel and setLogName.

Parameters:
_level - is the new Logger level.
_logName - is the name of the logging file.

log

public static boolean log(boolean _return,
                          int _level,
                          java.lang.String _message)
Log the specified message if the specified level is less than or equal to the member level. Return the specified return parameter as a convenienc for the caller.

Parameters:
_return - is the value to return to the caller.
_level - is the level of the message to check against the Logger level.
_message - is the message to display or log.

log

public static boolean log(boolean _return,
                          int _level,
                          java.lang.Throwable _e)
Log the specified exception and its initial cause(es) if the specified level is less than or equal to the member level. Return the specified return parameter as a convenienc for the caller.

Parameters:
_return - is the value to return to the caller.
_level - is the level of the message to check against the Logger level.
_e - is the exception to display or log.

log

public static boolean log(boolean _return,
                          int _level,
                          java.lang.String _message,
                          java.lang.Throwable _e)
Log the specified message if the specified level is less than or equal to the member level. Return the specified return parameter as a convenienc for the caller.

Parameters:
_return - is the value to return to the caller.
_level - is the level of the message to check against the Logger level.
_message - is the message to display or log.
_e - is the exception to display or log.