"

2013 FRC Java API

"

com.sun.squawk.util
Class Tracer

java.lang.Object
  extended by com.sun.squawk.util.Tracer
All Implemented Interfaces:
GlobalStaticFields

public final class Tracer
extends Object
implements GlobalStaticFields

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

setPrintStream

public static void setPrintStream(PrintStream out)
Sets the print stream to which traces will be written. This must be done before a call to trace(String) or traceln(String).

Parameters:
out - the print stream to which trace output is written

getPrintStream

public static PrintStream getPrintStream()
Gets the print stream to which traces will be written.

Returns:
the print stream to which trace output is written

setFilter

public static void setFilter(String filter)
Sets the string used to enable/disable the tracer. If filter is null, then filtering is turned off.

Parameters:
filter - the string used to enable/disable the tracer

enableFeature

public static void enableFeature(String feature)
Enable a given feature to be traced.

Parameters:
feature -

reset

public static void reset()
Disable all the enabled features and clears the filter (if any).


isTracing

public static boolean isTracing(String feature,
                                String component)
Determines whether or not a given feature is being traced for a given component.

Parameters:
feature - the feature to be traced
component - the component to be traced
Returns:
true if tracing this feature

isTracing

public static boolean isTracing(String feature)
Determines whether or not a given feature is being traced.

Parameters:
feature - the feature to be traced
Returns:
true if tracing this feature

trace

public static void trace(String message)
Output a string to the tracer's print stream.

Parameters:
message - the message to write

traceln

public static void traceln(String message)
Output a string to the tracer's print stream followed by a newline.

Parameters:
message - the message to write

"

2013 FRC Java API

"

"
For updated information see the Java FRC site
"