|
" 2013 FRC Java API " |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.squawk.util.Tracer
public final class Tracer
The Tracer class encapsulates a set of static methods that are used to emit execution traces to a print stream.
It is intended for usage of this class to be statically conditional. That is,
it need not exist in a production deployment. As such, all calls/references
to this class should be wrapped in a conditional test of the final static
boolean variable Klass#TRACING_ENALBED
. For example:
if (Klass.TRACING_ENABLED) && Tracer.isTracing("loading", klass.getName()) { Tracer.traceln("Loading "+klass.getName()); }
If the value of Klass.TRACING_ENABLED
was statically
determined to be false by javac, then this whole block of code would be
omitted from the compiled class.
Method Summary | |
---|---|
static void |
enableFeature(String feature)
Enable a given feature to be traced. |
static PrintStream |
getPrintStream()
Gets the print stream to which traces will be written. |
static boolean |
isTracing(String feature)
Determines whether or not a given feature is being traced. |
static boolean |
isTracing(String feature,
String component)
Determines whether or not a given feature is being traced for a given component. |
static void |
reset()
Disable all the enabled features and clears the filter (if any). |
static void |
setFilter(String filter)
Sets the string used to enable/disable the tracer. |
static void |
setPrintStream(PrintStream out)
Sets the print stream to which traces will be written. |
static void |
trace(String message)
Output a string to the tracer's print stream. |
static void |
traceln(String message)
Output a string to the tracer's print stream followed by a newline. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void setPrintStream(PrintStream out)
trace(String)
or traceln(String)
.
out
- the print stream to which trace output is writtenpublic static PrintStream getPrintStream()
public static void setFilter(String filter)
filter
is null, then filtering is turned off.
filter
- the string used to enable/disable the tracerpublic static void enableFeature(String feature)
feature
- public static void reset()
public static boolean isTracing(String feature, String component)
feature
- the feature to be tracedcomponent
- the component to be traced
public static boolean isTracing(String feature)
feature
- the feature to be traced
public static void trace(String message)
message
- the message to writepublic static void traceln(String message)
message
- the message to write
|
" 2013 FRC Java API " |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |