|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--iglu.util.Debug
Provides tools for debugging programs. Errors are reported to stderr unless a logfile has been set. If the logfile is set, case all debugging information goes to the file. There are several ways to use this class:
debugOut()
will appear in the debugging output every time
the code is run.
trace()
method at points where you would like tracing information. This information
will only appear if traceOn()
is set.
debugOut
. This
information will appear any time the tag appears in the list that is set
with setLevel
.
dassert
that a statement is true. If the statement is
true, nothing will happen. If the statement is false, an error will
be triggered.
Field Summary | |
private static java.lang.String[] |
debugLevel
|
private static boolean |
errorsFatal
|
private static java.io.PrintWriter |
logFileWriter
|
private static boolean |
quieter
|
private static long |
timeStamp
|
private static boolean |
traceOn
|
private static boolean |
viewAllErrors
|
Constructor Summary | |
private |
Debug()
|
Method Summary | |
private static void |
checkFatal()
Kills the program if errors have been set to fatal. |
static void |
dassert(boolean test)
If the test is false, prints a message. |
static void |
dassert(boolean test,
java.lang.String message)
If the test is false, prints the message. |
static void |
debugOut(java.lang.String s)
Send a message to the debugging output stream. |
static void |
debugOut(java.lang.String triggerLevel,
int message)
|
static void |
debugOut(java.lang.String triggerLevel,
java.lang.String message)
Prints a comment if the triggerLevel is one of the active tags, as set by setLevel . |
private static java.lang.String |
getCaller()
Returns the name of the method that called the debugger. |
static boolean |
isSet(java.lang.String triggerLevel)
Returns true if the triggerLevel is one of the active tags |
static void |
main(java.lang.String[] args)
Runs some tests on this class. |
static void |
notImplemented()
Tells the user that the calling method hasn't been implemented. |
static void |
reportError(java.lang.String message)
Reports an error, exiting if errors are fatal. |
static void |
reportError(java.lang.String module,
java.lang.String message)
Reports an error, exiting if errors are fatal. |
static void |
setFatal()
Sets all errors to be fatal. |
static void |
setLevel(java.lang.String[] newLevel)
Sets list of debugging tags to view. |
static void |
setLevelAll()
Sets the debugger to view ALL debugging tags. |
static void |
setLogFile(java.io.File logFile)
Redirects all output to logFile. |
static void |
setQuieter(boolean nQuieter)
Control verbosity of messages. |
static void |
tic()
Sets the timer |
static double |
toc()
Returns the number of seconds transpired since the last time tic() was called. |
static void |
trace(java.lang.String message)
Prints a message to System.out if tracing mode is on. |
static void |
traceOff()
Turns tracing mode off. |
static void |
traceOn()
Turns tracing mode on. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static boolean errorsFatal
private static boolean traceOn
private static java.io.PrintWriter logFileWriter
private static java.lang.String[] debugLevel
private static boolean quieter
private static boolean viewAllErrors
private static long timeStamp
Constructor Detail |
private Debug()
Method Detail |
public static void setLogFile(java.io.File logFile) throws java.io.IOException
java.io.IOException
public static void debugOut(java.lang.String s)
public static void setQuieter(boolean nQuieter)
nQuieter
is true,
messages will be as short as possible. If it is false, all
messages will include an indication that they were generated by
the Debugging system, along with the the associated level tag, if any.
public static void setFatal()
setError()
.
public static void setLevel(java.lang.String[] newLevel)
public static void setLevelAll()
public static boolean isSet(java.lang.String triggerLevel)
public static void debugOut(java.lang.String triggerLevel, int message)
public static void debugOut(java.lang.String triggerLevel, java.lang.String message)
setLevel
.
public static void traceOn()
trace()
. These statements can be
seen if tracing is on.
public static void traceOff()
public static void trace(java.lang.String message)
public static void notImplemented()
public static void dassert(boolean test)
public static void dassert(boolean test, java.lang.String message)
private static java.lang.String getCaller()
The stack should look something like:
java.lang.Throwable
at iglu.util.Debug.getCaller(Debug.java:155)
at iglu.util.Debug.dassert(Debug.java:139)
at <
public static void reportError(java.lang.String message)
dassert(false,message)
public static void reportError(java.lang.String module, java.lang.String message)
dassert(false,message)
private static void checkFatal()
public static void tic()
public static double toc()
public static void main(java.lang.String[] args) throws java.io.IOException
java.io.IOException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |