com.sybase.jdbcx
Interface Debug


public abstract interface Debug

A set of debugging functions.


Method Summary
 void assert(Object o, boolean condition, String n)
          Asserts a condition, throws an exception when the expected condition is not met.
 void debug(boolean onOff, String classes)
          Turns the debugging output on or off.
 void debug(boolean onOff, String classes, PrintStream logstream)
          Turns the debugging output on or off.
 void println(Object o, String s)
          Writes a message to the debugOutputStream if debugging is enabled and the object is included in the list of classes to debug.
 void println(String s)
          Writes message to the current debugOutputStream if debugging is enabled.
 void startTimer(Object obj)
          Starts a timer to measure elapsed milliseconds of an event.
 void stopTimer(Object obj, String str)
          Stops the timer and prints elapsed milliseconds of an event.
 

Method Detail

debug

public void debug(boolean onOff,
                  String classes)
           throws IOException
Turns the debugging output on or off. Output goes to System.out unless the sybLogStream system property is set, in which case it goes to a new file by that name.
Parameters:
onOff - true turns debugging on, false turns it off
classes - the colon-separated list of classes to debug, or "ALL". The special keyword "STATIC" may be included in the list to get debugging output for static methods.

debug

public void debug(boolean onOff,
                  String classes,
                  PrintStream logstream)
           throws IOException
Turns the debugging output on or off.
Parameters:
onOff - true turns debugging on, false turns it off
classes - the list of classes to debug, or "ALL". The special keyword "STATIC" may be included in the list to get debugging output for static methods.
logstream - the stream where the debug trace is output

startTimer

public void startTimer(Object obj)
Starts a timer to measure elapsed milliseconds of an event. Keeps one timer per object and one for all static methods.
Parameters:
obj - object to time; null means static timing

stopTimer

public void stopTimer(Object obj,
                      String str)
Stops the timer and prints elapsed milliseconds of an event.
Parameters:
obj - object to time; null for static timing
str - message to print with output

println

public void println(String s)
Writes message to the current debugOutputStream if debugging is enabled.
Parameters:
s - the message to print

println

public void println(Object o,
                    String s)
Writes a message to the debugOutputStream if debugging is enabled and the object is included in the list of classes to debug.

If the method calling this method is static, and therefore cannot pass a reference to 'this' as the 'o' argument, it should pass null.

Parameters:
o - reference to class which is printing this message
s - the message to print

assert

public void assert(Object o,
                   boolean condition,
                   String n)
            throws RuntimeException
Asserts a condition, throws an exception when the expected condition is not met.
Parameters:
o - reference to class which is printing this message
condition - the condition which is expected to be true
n - a message to print out when the condition is not met
Throws:
a - RuntimeException if the condition is false