edu.columbia.cs.util
Class Log

java.lang.Object
  |
  +--edu.columbia.cs.util.Log

public class Log
extends java.lang.Object

Logs messages to appropriate streams specified by a properties file. If an appropriate file stream cannot be found, System.out is used.


Field Summary
static int DEBUG
           
 java.io.PrintStream debugStream
           
static int DEFAULT
           
static int ERROR
           
 java.io.PrintStream errorStream
           
static int INFO
           
 java.io.PrintStream infoStream
           
 java.lang.String[] LOG_LEVEL
           
static int SILENT
           
static int WARNING
           
 java.io.PrintStream warningStream
           
 
Constructor Summary
Log()
          Constructs a new Log with the default properties.
Log(java.lang.String filename)
          Constructs a new Log with a specified properties file.
 
Method Summary
 int getLogLevel()
          Returns the current level of logging.
 java.io.PrintStream getLogStream(int logType)
          Returns the appropriate log stream.
 void logMessage(int logtype, java.lang.String msg)
          Log a message.
 void logMessage(int logtype, java.lang.String classname, java.lang.String msg)
          Log a message with a prepended class name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SILENT

public static final int SILENT

ERROR

public static final int ERROR

WARNING

public static final int WARNING

INFO

public static final int INFO

DEBUG

public static final int DEBUG

DEFAULT

public static final int DEFAULT

LOG_LEVEL

public java.lang.String[] LOG_LEVEL

errorStream

public java.io.PrintStream errorStream

warningStream

public java.io.PrintStream warningStream

infoStream

public java.io.PrintStream infoStream

debugStream

public java.io.PrintStream debugStream
Constructor Detail

Log

public Log()
Constructs a new Log with the default properties.

Log

public Log(java.lang.String filename)
Constructs a new Log with a specified properties file.
Parameters:
filename - the name of the properties file
Method Detail

getLogLevel

public int getLogLevel()
Returns the current level of logging.
Returns:
Returns the current log level

logMessage

public void logMessage(int logtype,
                       java.lang.String msg)
Log a message.
Parameters:
logtype - the log type
msg - the message to log

logMessage

public void logMessage(int logtype,
                       java.lang.String classname,
                       java.lang.String msg)
Log a message with a prepended class name.
Parameters:
logtype - the log type
classname - the name of the class to prepend
msg - the message to log

getLogStream

public java.io.PrintStream getLogStream(int logType)
Returns the appropriate log stream.
Parameters:
logType - the type of log level