|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.multijava.mjc.Debug
This singleton class localizes the reporting of debugging information. It includes features like indenting to match depth of the call stack and prefixes to indicate what section of code is being executed. It also allows users to specify an output stream other than standard out (e.g., a file).
| Field Summary | |
private static String |
BLANK
|
private static boolean |
debug
|
private static int |
indent
|
private static BreakIterator |
lineBreaker
|
private static ArrayList |
lines
|
private static int |
lineWidth
|
private static long |
messageMask
|
private static Map |
metaDebugMap
|
private static PrintStream |
out
|
private static String |
prefix
|
private static Map |
profileMap
|
static PrintStream |
stderr
A cache of System.err so we can hack around code that uses System.setErr() |
private static String |
TAB
|
private static int |
TAB_LENGTH
|
| Constructor Summary | |
private |
Debug()
Overrides the default initialize so this class cannot be instantiated. |
| Method Summary | |
static void |
breakMe()
This method does nothing. |
static void |
close()
Closes a debugging session and print the indent stack if the outdents did not match the indents. |
static void |
initialize()
Resets the debug reporting methods to turn off debugging and use standard error as the output stream |
static void |
initialize(boolean debug)
Resets the debug reporting methods to use standard error as the output stream. |
static void |
initialize(boolean debug,
PrintStream out)
Resets the debug reporting methods. |
static boolean |
isDebugOn()
Indicates whether debugging output is currently activated. |
static void |
msg(String msg)
Writes the given debugging message to the debugging output stream. |
static void |
msg(MessageDescription msg)
Writes the given debugging message, without parameter substitution, to the debugging output stream. |
static void |
msg(MessageDescription msg,
Object p0)
Writes the given debugging message, with appropriate parameter substitution, to the debugging output stream. |
static void |
msg(MessageDescription msg,
Object p0,
Object p1)
Writes the given debugging message, with appropriate parameter substitution, to the debugging output stream. |
static void |
msg(MessageDescription msg,
Object[] ps)
Writes the given debugging message, with appropriate parameter substitution, to the debugging output stream. |
private static void |
output(String fullMsg)
Writes the given string to the debug output stream handling indenting, prefixes and line wrapping. |
static long |
profileEnd(Object profileID)
Finishes profiling for a block of code with the given profileID object by returning the time (in milliseconds) since profileStart was called for the given ID. |
static String |
profileEndAsString(Object profileID)
Finishes profiling for a block of code with the given profileID object by returning a String of the form (profileID.toString + "took x ms") where x is the time (in milliseconds) since profileStart was called for the given ID. |
static void |
profileStart(Object profileID)
Begins profiling for a block of code with the given profileID object. |
static void |
recordMessage(String msg)
Appends the given string to a file named MultiJavaDebugMessages.txt in the current temporary directory, creating the file if it does not exist. |
private static void |
registerIndent(Object caller,
String msg)
|
private static void |
registerOutdent(Object caller)
|
static void |
setPrefix(String prefix)
Sets the prefix that is written before each debugging message. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private static boolean debug
private static PrintStream out
private static String prefix
private static int indent
private static int lineWidth
private static long messageMask
private static final String TAB
private static final String BLANK
private static final int TAB_LENGTH
private static final BreakIterator lineBreaker
private static final ArrayList lines
private static final Map metaDebugMap
private static final Map profileMap
public static final PrintStream stderr
| Constructor Detail |
private Debug()
| Method Detail |
public static void initialize()
public static void initialize(boolean debug)
debug - indicates whether debug reporting methods
should report
public static void initialize(boolean debug,
PrintStream out)
debug - indicates whether debug reporting methods
should reportout - the stream to write debug messages topublic static void setPrefix(String prefix)
prefix - the prefix that should precede all output linespublic static boolean isDebugOn()
public static void close()
public static void msg(String msg)
msg - the string to writepublic static void msg(MessageDescription msg)
msg - the MessageDescription to write
public static void msg(MessageDescription msg,
Object p0)
msg - the MessageDescription to writep0 - the object to substitute for {0} in msg
public static void msg(MessageDescription msg,
Object p0,
Object p1)
msg - the MessageDescription to writep0 - the object to substitute for {0} in msgp1 - the object to substitute for {1} in msg
public static void msg(MessageDescription msg,
Object[] ps)
msg - the MessageDescription to writeps - the objects to substitute msgprivate static void output(String fullMsg)
fullMsg - the String to write public static void profileStart(Object profileID)
profileEnd( Object )public static long profileEnd(Object profileID)
profileStart( Object )public static String profileEndAsString(Object profileID)
profileStart( Object )public static void recordMessage(String msg)
private static void registerIndent(Object caller,
String msg)
private static void registerOutdent(Object caller)
public static void breakMe()
|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||