edu.mssm.crover.joe
Class LogImpl

java.lang.Object
  |
  +--edu.mssm.crover.joe.LogImpl
All Implemented Interfaces:
Log

public class LogImpl
extends java.lang.Object
implements Log

Simple LogImpl API for RbDe use.


Field Summary
 
Fields inherited from interface edu.mssm.crover.joe.Log
ALL_BUT_DEBUG, ALL_SUPPORTED_SEVERITY_FLAGS, DEBUG, EXCEPTIONS, FATAL, INFO, PROBLEM, SEVERE, SILENT, VERBOSE, WARNING
 
Constructor Summary
LogImpl()
          The default configuration of the masks is quite pedantic for the console (stderr) and file log but sparse for the GUI.
 
Method Summary
protected  void appendLogFile(java.lang.String msg)
           
protected  void appendLogFile(java.lang.String msg, java.lang.Throwable e)
          Opens, append then close the logfile.
 java.lang.String getLevelString(int level)
           
 void log(int level, java.lang.String message)
           
 void log(int level, java.lang.String message, java.lang.Exception e)
           
static void main(java.lang.String[] args)
          Run a simple test of the Log feature.
 void setFileReportingLevel(int mask)
          Mask the events that have to be written to the log file.
 void setLogDate(boolean show)
          Turns on/off the addition of the current date in the logs.
 void setLogFile(java.io.File f)
          Sets the log-file path.
 void setPopupLevel(int mask)
          Mask the events that have to bring GUI popup dialogs.
 void setReportingLevel(int mask)
          Mask the events that have to be reported.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogImpl

public LogImpl()
The default configuration of the masks is quite pedantic for the console (stderr) and file log but sparse for the GUI. In any case you do not get the VERBOSE bla bla by default.

Method Detail

getLevelString

public java.lang.String getLevelString(int level)
Specified by:
getLevelString in interface Log

log

public void log(int level,
                java.lang.String message)
Specified by:
log in interface Log

log

public void log(int level,
                java.lang.String message,
                java.lang.Exception e)
Specified by:
log in interface Log

setReportingLevel

public void setReportingLevel(int mask)
                       throws InvalidArgumentException
Mask the events that have to be reported. If you want to see only FATAL errors, use
 setReportingLevel(Log.FATAL);
If you prefer to see everyting but general information, do
setReportingLevel(Log.FATAL|Log.SEVERE|Log.PROBLEM|Log.WARNING);
All the combinations are available.

Specified by:
setReportingLevel in interface Log
Parameters:
mask - A boolean mask made of the boolean combination of the severity flags.
InvalidArgumentException

setPopupLevel

public void setPopupLevel(int mask)
                   throws InvalidArgumentException
Mask the events that have to bring GUI popup dialogs. Configure sensibly or let the user do the configuration as too many popups can be really annonying, and too few can lead to unoticed errors.

Specified by:
setPopupLevel in interface Log
Parameters:
mask - A boolean mask made of the boolean combination of the severity flags.
InvalidArgumentException
See Also:
for example of the mask use.

setFileReportingLevel

public void setFileReportingLevel(int mask)
                           throws InvalidArgumentException
Mask the events that have to be written to the log file.

Specified by:
setFileReportingLevel in interface Log
Parameters:
mask - A boolean mask made of the boolean combination of the severity flags.
InvalidArgumentException
See Also:
for example of the mask use.

setLogFile

public void setLogFile(java.io.File f)
                throws java.io.IOException
Sets the log-file path. Opens the log-file and start logging to file. A message of start is loggued and flushed so that it should be available soon after the call returns.

Specified by:
setLogFile in interface Log
Throws:
java.io.IOException - When a problem occur opening the file or appending the start message.

appendLogFile

protected void appendLogFile(java.lang.String msg)
                      throws java.io.IOException
java.io.IOException

appendLogFile

protected void appendLogFile(java.lang.String msg,
                             java.lang.Throwable e)
                      throws java.io.IOException
Opens, append then close the logfile. Used to append a string to a log-file.

java.io.IOException

setLogDate

public void setLogDate(boolean show)
Turns on/off the addition of the current date in the logs. The default is true.

Specified by:
setLogDate in interface Log

main

public static void main(java.lang.String[] args)
Run a simple test of the Log feature.



Copyright @ 2003 Mount Sinai School of Medicine. All Rights Reserved.