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.
|
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 |
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
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
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 typemsg - 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 typeclassname - the name of the class to prependmsg - the message to log
getLogStream
public java.io.PrintStream getLogStream(int logType)
- Returns the appropriate log stream.
- Parameters:
logType - the type of log level