com.mindbright.util
public class Log extends java.lang.Object
LEVEL_EMERG
- emergency messagesLEVEL_ALERT
- alert messagesLEVEL_ERROR
- error messagesLEVEL_WARNING
- warning messagesLEVEL_NOTICE
- noticesLEVEL_INFO
- informational messagesLEVEL_DEBUG
- debug messagesLEVEL_DEBUG2
- detailed debug messagesModifier and Type | Field and Description |
---|---|
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 and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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 |
debug(java.lang.Throwable t)
Write a throwable to the log
|
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
|
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
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 logpublic 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 logpublic void debug(java.lang.Throwable t)
t
- throwable to dump