UC Berkeley Group for User Interface Research
Updated November 17, 2000

edu.berkeley.guir.lib.debugging
Class LogFile

java.lang.Object
  |
  +--edu.berkeley.guir.lib.debugging.LogFile

public class LogFile
extends Object

A file for logging messages.

Error messages should contain:

This software is distributed under the Berkeley Software License.

 Revisions:  - GUIRLib-v1.0-1.0.0, Jul 09 1997, JH
               Created class
             - GUIRLib-v1.2-1.0.0, Jun 22 2000, JH
               Touched for GUIRLib release
             - GUIRLib-v1.3-1.0.0, Aug 11 2000, JH
               Touched for GUIRLib release
             - GUIRLib-v1.4-1.0.0, Aug 31 2000, JH
               Touched for GUIRLib release
 

Since:
1.1.2
Version:
GUIRLib-v1.4-1.0.0, Aug 31 2000
Author:
Danyel Fisher ( danyelf@cs.berkeley.edu), Jason Hong ( jasonh@cs.berkeley.edu)

Field Summary
static String DEFAULT_LOGFILE
          Name of the logfile if no logfile name is specified
 
Constructor Summary
LogFile()
          Default constructor: picks default date.
LogFile(PrintWriter printWriter)
          Convenience constructor knows about dates.
LogFile(PrintWriter printWriter, DateFormat dFormatDate, DateFormat dFormatTime)
          Constructor.
LogFile(String strLogFileName)
          Convenience constructor: picks a default date format.
 
Method Summary
 void close()
          Close the log file.
 void finalize()
           
 String getSeverityLevel(int iSeverity)
          Given a severity level, translate it into a String.
 void logMessage(int iSeverity, String strMessage)
          Record the specified message to the log.
 void logMessage(String strMessage)
          Record the specified message with the specified severity level to the log.
static void main(String[] argv)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_LOGFILE

public static final String DEFAULT_LOGFILE
Name of the logfile if no logfile name is specified
Constructor Detail

LogFile

public LogFile()
        throws IOException
Default constructor: picks default date. Sets the name of the logfile to the default log filename.
Throws:
IOException - if there is a problem writing to the file.

LogFile

public LogFile(String strLogFileName)
        throws IOException
Convenience constructor: picks a default date format.
Parameters:
strLogFileName - is the filename of the log file.
Throws:
IOException - if there is a problem writing to the file.

LogFile

public LogFile(PrintWriter printWriter)
        throws IOException
Convenience constructor knows about dates.
Parameters:
printWriter - is the output stream: perhaps new PrintWriter( System.out );
Throws:
IOException - if there is a problem writing to the file.

LogFile

public LogFile(PrintWriter printWriter,
               DateFormat dFormatDate,
               DateFormat dFormatTime)
        throws IOException
Constructor.
Parameters:
printWriter - is the PrintWriter that points to the log file.
dFormatDate - is the date format to be used
Throws:
IOException - if there is a problem writing to the file.
Method Detail

finalize

public void finalize()
Overrides:
finalize in class Object

getSeverityLevel

public String getSeverityLevel(int iSeverity)
Given a severity level, translate it into a String.
Parameters:
iSeverity - is the severity level.
Returns:
A String containing the severity level in words.

close

public void close()
Close the log file.

logMessage

public void logMessage(int iSeverity,
                       String strMessage)
Record the specified message to the log.
Parameters:
strMessage - is the message to log.

logMessage

public void logMessage(String strMessage)
Record the specified message with the specified severity level to the log.
Parameters:
iSeverity - is the severity level of the message.
strMessage - is the message to log.

main

public static void main(String[] argv)

Copyright Information