|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectabbot.Log
Various logging, assertion, and debug routines. Typical usage is to include the following code
public static void main(String[] args) {
args = Log.init(args)
...
}
at an application's main entry point. This way the Log class can remove its
options from the full set passed into the application. See the
Log.init method for initialization
options. General usage notes on public functions:
Per-class stack trace depth can be specified when adding a class, e.g. classname[:stack-depth].
Field Summary | |
static boolean |
DEBUG_BUILD
Global final to determine whether debugging code is generated. |
static boolean |
expectDebugOutput
Whether any debugging output is enabled. |
static int |
FULL_STACK
Mnemonic to print all lines of a stack trace. |
(package private) static PrintStream |
systemErr
|
(package private) static PrintStream |
systemOut
|
Method Summary | |
static void |
addDebugClass(Class c)
Indicate the class to add to debug output. |
static void |
addDebugClass(Class c,
int depth)
Indicate that debug messages should be output for the given class. |
static void |
addDebugClass(String id)
Indicate the class name[:depth] to add to debug output. |
static void |
assertNotSwing()
Assert that the current thread is NOT the swing thread. |
static void |
assertSwing()
Assert that the current thread is the swing thread. |
static void |
assertTrue(boolean test)
Basic assertion. |
static void |
assertTrue(String desc,
boolean test)
Standard assert, with a message provided since java can't easily stringify a boolean expression. |
static void |
close()
|
static void |
debug()
Print an empty debug message. |
static void |
debug(Class c,
String event)
Use this version for performance-critical/high traffic areas |
static void |
debug(Object obj)
Print a debug message using the object given stringified as the message. |
static void |
debug(String event)
Print a debug message. |
static void |
debug(String event,
int lines)
Print a debug message with the given number of stack lines. |
static void |
debug(Throwable thr)
Similar to warn(Throwable). |
static void |
enableLogging(String filename)
Enable log output to the given file. |
static String |
getStack(int lines)
Retrieve the given number of lines of the current stack, as a string. |
static String |
getStack(int lines,
Throwable thr)
Retrieve the given number of lines of stack from the given Throwable, as a string. |
static String |
getStack(Throwable thrown)
|
static String[] |
init(String[] args)
Debug/log initialization, presumably from the command line. |
static boolean |
isClassDebugEnabled(Class c)
|
static void |
log(String message)
Log a message. |
static void |
log(String message,
Throwable thr)
|
static void |
log(Throwable thr)
Log an exception. |
static boolean |
loggingEnabled()
Is log output enabled? |
static void |
removeDebugClass(Class c)
Indicate that the given class should NOT be debugged (assuming --debug all) |
static void |
removeDebugClass(String id)
Indicate the class name to exclude from debug output. |
static void |
setDebugStackDepth(int depth)
Sets the debug stack depth to the given amount |
static void |
warn(String message)
Issue a programmer warning, which will include the source line of the warning. |
static void |
warn(String message,
int lines)
Issue a programmer warning, which will include the source line of the warning, and a stack trace with up to the given number of lines. |
static void |
warn(Throwable thr)
Issue a programmer warning, which will include the source line of the original thrown object. |
static void |
warnIfNotSwing()
print warning if not invoked on Swing thread |
static void |
warnIfNotSwing(int lines)
print warning if not invoked on Swing thread, with given number of lines of stack trace. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final boolean DEBUG_BUILD
public static final int FULL_STACK
public static boolean expectDebugOutput
static PrintStream systemOut
static PrintStream systemErr
Method Detail |
public static String[] init(String[] args)
--debug all | className[:depth] | *.partialClassName[:depth] --no-debug className | *.partialClassName --log--no-timestamp --enable-warnings --show-threads --stack-depth --exception-depth
public static boolean loggingEnabled()
public static void enableLogging(String filename)
public static void setDebugStackDepth(int depth)
public static void removeDebugClass(String id)
public static void removeDebugClass(Class c)
public static void addDebugClass(String id)
public static void addDebugClass(Class c)
public static void addDebugClass(Class c, int depth)
public static boolean isClassDebugEnabled(Class c)
public static void debug(Class c, String event)
public static void debug(String event)
public static void debug(String event, int lines)
public static void debug()
public static void debug(Throwable thr)
public static void debug(Object obj)
public static String getStack(int lines)
public static String getStack(int lines, Throwable thr)
public static String getStack(Throwable thrown)
public static void warn(String message)
public static void warn(String message, int lines)
public static void warn(Throwable thr)
public static void assertTrue(String desc, boolean test)
public static void assertTrue(boolean test)
public static void assertSwing()
public static void warnIfNotSwing(int lines)
public static void warnIfNotSwing()
public static void assertNotSwing()
public static void log(Throwable thr)
public static void log(String message, Throwable thr)
public static void log(String message)
public static void close()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |