|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjimm.twice.util.Logger
What goes down stairs, alone or in pairs?
Rolls over your neighbor's dog?
What's great for a snack and fits on your back?
It's Log!
Field Summary | |
static int |
DEBUG
|
protected static java.lang.String |
DEFAULT_LOG_DIR
|
protected static int |
DEFAULT_LOG_LEVEL
|
protected static java.lang.String |
DEFAULT_LOG_PREFIX
|
protected boolean |
echo
|
static int |
ERROR
|
static int |
FATAL
|
protected java.text.SimpleDateFormat |
formatter
|
static int |
INFO
|
protected java.lang.String |
logDir
|
protected int |
logLevel
|
static int |
WARNING
|
Constructor Summary | |
protected |
Logger()
Constructor. |
Method Summary | |
boolean |
getEcho()
|
java.lang.String |
getLogDir()
|
int |
getLogLevel()
|
static Logger |
instance()
Returns the single instance of this class. |
void |
log(int level,
java.lang.String logPrefix,
java.lang.Object obj)
Writes a log message. |
void |
log(int level,
java.lang.String logPrefix,
java.lang.String location,
java.lang.Object obj)
Writes a log message. |
void |
setEcho(boolean val)
Determines if log messages are echoed to System.err . |
void |
setLogDir(java.lang.String dir)
Sets (and creates if necessary) the directory that will contain the log files. |
void |
setLogLevel(int level)
Sets the level above which log messages will be ignored. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int FATAL
public static final int ERROR
public static final int WARNING
public static final int INFO
public static final int DEBUG
protected static final java.lang.String DEFAULT_LOG_DIR
protected static final java.lang.String DEFAULT_LOG_PREFIX
protected static final int DEFAULT_LOG_LEVEL
protected java.lang.String logDir
protected int logLevel
protected java.text.SimpleDateFormat formatter
protected boolean echo
Constructor Detail |
protected Logger()
true
so log messages will be echoed to
System.err
Method Detail |
public static Logger instance()
public java.lang.String getLogDir()
public void setLogDir(java.lang.String dir)
dir
- a directory pathpublic int getLogLevel()
public void setLogLevel(int level)
level
- one of FATAL
, ERROR
,
WARNING
, INFO
, or DEBUG
public boolean getEcho()
public void setEcho(boolean val)
System.err
.
val
- if true
, future log messages will be echoed
to System.err
.public void log(int level, java.lang.String logPrefix, java.lang.Object obj)
level
- the debug levellogPrefix
- the beginning of the log file nameobj
- the string created by the object's toString
is
written to the logpublic void log(int level, java.lang.String logPrefix, java.lang.String location, java.lang.Object obj)
echo
is true
,
also writes the message to System.err.
level
- the debug levellogPrefix
- the beginning of the log file namelocation
- written after the time stamp, this is usually a method
or class name; may be null
obj
- the object's string representation is written to the log
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |