|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mindbright.util.Log
A class which handles logging messages to a stream. All printed messages are time-stamped. Messages can have different levels and it is possible to change which levels should be written to the stream. The levels are ordered like this (in decreasing order of severity):
LEVEL_EMERG
- emergency messagesLEVEL_ALERT
- alert messagesLEVEL_ERROR
- error messagesLEVEL_WARNING
- warning messagesLEVEL_NOTICE
- noticesLEVEL_INFO
- informational messagesLEVEL_DEBUG
- debug messagesLEVEL_DEBUG2
- detailed debug messages
Field Summary | |
static int |
LEVEL_ALERT
|
static int |
LEVEL_DEBUG
|
static int |
LEVEL_DEBUG2
|
static int |
LEVEL_EMERG
|
static int |
LEVEL_ERROR
|
static int |
LEVEL_INFO
|
static int |
LEVEL_NOTICE
|
static int |
LEVEL_WARNING
|
Constructor Summary | |
Log(int level)
Construct an instance which logs to System.err and which ignores messages below the given level. |
|
Log(java.io.OutputStream logOut,
int level)
Construct an instance which logs to the given stream and which ignores messages below the given level. |
Method Summary | |
void |
close()
Closes the output stream (unless it is System.err) |
void |
debug(java.lang.String callClass,
java.lang.String message)
Log a debug message |
void |
debug(java.lang.String callClass,
java.lang.String callMethod,
java.lang.String message)
Log a debug message |
void |
debug2(java.lang.String callClass,
java.lang.String callMethod,
java.lang.String message)
Log a detailed debug message |
void |
debug2(java.lang.String callClass,
java.lang.String callMethod,
java.lang.String message,
byte[] dumpBuf)
Log a detailed debug message which also includes a hex-dump of some data. |
void |
debug2(java.lang.String callClass,
java.lang.String callMethod,
java.lang.String message,
byte[] dumpBuf,
int off,
int len)
Log a detailed debug message which also includes a hex-dump of some data. |
void |
error(java.lang.String callClass,
java.lang.String callMethod,
java.lang.String message)
Log an error message |
void |
info(java.lang.String callClass,
java.lang.String message)
Log an informational message |
void |
message(int level,
java.lang.String callClass,
java.lang.String message)
Log a message |
void |
message(int level,
java.lang.String callClass,
java.lang.String callMethod,
java.lang.String message)
Log a message |
void |
notice(java.lang.String callClass,
java.lang.String message)
Log a notice message |
void |
setLevel(int level)
Change the log cutoff level. |
void |
setLogOutputStream(java.io.OutputStream logOut)
Changes the stream log messages are printed on |
void |
warning(java.lang.String callClass,
java.lang.String message)
Log a warning message |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int LEVEL_EMERG
public static final int LEVEL_ALERT
public static final int LEVEL_ERROR
public static final int LEVEL_WARNING
public static final int LEVEL_NOTICE
public static final int LEVEL_INFO
public static final int LEVEL_DEBUG
public static final int LEVEL_DEBUG2
Constructor Detail |
public Log(int level)
level
- the lowest level of messages to logpublic Log(java.io.OutputStream logOut, int level)
logOut
- the stream to print log messages tolevel
- the lowest level of messages to logMethod Detail |
public void setLogOutputStream(java.io.OutputStream logOut)
logOut
- the new stream to print messages onpublic void close()
public void message(int level, java.lang.String callClass, java.lang.String message)
level
- the severity of this messagecallClass
- name of class generating the messagemessage
- the log messagepublic void message(int level, java.lang.String callClass, java.lang.String callMethod, java.lang.String message)
level
- the severity of this messagecallClass
- name of class generating the messagecallMethod
- name of method in calling class which
generated messagemessage
- the log messagepublic void error(java.lang.String callClass, java.lang.String callMethod, java.lang.String message)
callClass
- name of class generating the messagecallMethod
- name of method in calling class which
generated messagemessage
- the log messagepublic void warning(java.lang.String callClass, java.lang.String message)
callClass
- name of class generating the messagemessage
- the log messagepublic void notice(java.lang.String callClass, java.lang.String message)
callClass
- name of class generating the messagemessage
- the log messagepublic void info(java.lang.String callClass, java.lang.String message)
callClass
- name of class generating the messagemessage
- the log messagepublic void debug(java.lang.String callClass, java.lang.String callMethod, java.lang.String message)
callClass
- name of class generating the messagecallMethod
- name of method in calling class which
generated messagemessage
- the log messagepublic void debug(java.lang.String callClass, java.lang.String message)
callClass
- name of class generating the messagemessage
- the log messagepublic void debug2(java.lang.String callClass, java.lang.String callMethod, java.lang.String message)
callClass
- name of class generating the messagecallMethod
- name of method in calling class which
generated messagemessage
- the log messagepublic void debug2(java.lang.String callClass, java.lang.String callMethod, java.lang.String message, byte[] dumpBuf, int off, int len)
callClass
- name of class generating the messagecallMethod
- name of method in calling class which
generated messagemessage
- the log messagedumpBuf
- array containing data to be dumpedoff
- offset of first byte to dumplen
- number of bytes to dumppublic void debug2(java.lang.String callClass, java.lang.String callMethod, java.lang.String message, byte[] dumpBuf)
callClass
- name of class generating the messagecallMethod
- name of method in calling class which
generated messagemessage
- the log messagedumpBuf
- array containing data to be dumpedpublic void setLevel(int level)
level
- the lowest level of messages to log
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |