wt.util
Class DebugWriter

java.lang.Object
  extended bywt.util.DebugWriter
All Implemented Interfaces:
Serializable

public class DebugWriter
extends Object
implements Serializable

This class provides standard methods for reporting various categories of information to aid in debugging. No static methods should be added to this class, since that makes it much more difficult to promote it to an interface, if this becomes desireable in the future.

Supported API: true

Extendable: false

See Also:
Serialized Form

Field Summary
private  boolean addThreadNames
           
private static String CLASSNAME
           
private  SimpleDateFormat dateFormat
           
private  OutputFile log
           
private static PrintStream OUT
           
private static long previousTimeSec
           
private static String RESOURCE
           
private  boolean tee
           
private static String timeStamp
           
private  boolean verbose
           
 
Constructor Summary
DebugWriter()
           
 
Method Summary
 void dump(Object object)
          Reports a dump of the state of an object.
 void enter(String classname, String method)
          Reports the entry into a method.
 void enter(String classname, String method, Object[] args)
          Reports the entry into a method.
 void exception(Throwable exception)
          Reports the String representation of the exception.
 void exception(Throwable exception, boolean stack_trace)
          Reports the String representation of the exception and prints its stack trace.
 void exit(String classname, String method)
          Reports the exit from a method.
 void exit(String classname, String method, boolean return_arg)
          Reports the exit from a method.
 void exit(String classname, String method, byte return_arg)
          Reports the exit from a method.
 void exit(String classname, String method, char return_arg)
          Reports the exit from a method.
 void exit(String classname, String method, double return_arg)
          Reports the exit from a method.
 void exit(String classname, String method, float return_arg)
          Reports the exit from a method.
 void exit(String classname, String method, int return_arg)
          Reports the exit from a method.
 void exit(String classname, String method, long return_arg)
          Reports the exit from a method.
 void exit(String classname, String method, Object return_arg)
          Reports the exit from a method.
 void exit(String classname, String method, short return_arg)
          Reports the exit from a method.
protected  void finalize()
           
 void identify(Object object)
          Reports the identity of an object.
private  String iteratedFilename(String name, int iterations)
           
 void printStackTrace(String message)
          Reports a stack trace, after printing passed message.
private  void printStackTrace(Throwable stackAccess)
           
 void report(String message)
          Reports the passed message.
 void setLogFile(String name, boolean append, boolean tee, int iterations, String date_format, boolean add_thread)
          Deprecated.  
 void setLogFile(String name, boolean append, boolean tee, int iterations, String date_format, boolean add_thread, boolean verbose)
          Sets the log file output parameters.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

OUT

private static final PrintStream OUT

tee

private boolean tee

addThreadNames

private boolean addThreadNames

dateFormat

private SimpleDateFormat dateFormat

timeStamp

private static String timeStamp

previousTimeSec

private static long previousTimeSec

log

private OutputFile log

verbose

private boolean verbose
Constructor Detail

DebugWriter

public DebugWriter()
Method Detail

report

public void report(String message)
Reports the passed message.

Supported API: true

Parameters:
message - the text to report

enter

public void enter(String classname,
                  String method)
Reports the entry into a method.

Supported API: false

Parameters:
classname - is the name of the calling class
method - is the name of the calling method

enter

public void enter(String classname,
                  String method,
                  Object[] args)
Reports the entry into a method.

Supported API: false

Parameters:
classname - is the name of the calling class
method - is the name of the calling method
args - is the array of the values that are being passed into the calling method

exit

public void exit(String classname,
                 String method)
Reports the exit from a method.

Supported API: false

Parameters:
classname - is the name of the calling class
method - is the name of the calling method

exit

public void exit(String classname,
                 String method,
                 Object return_arg)
Reports the exit from a method.

Supported API: false

Parameters:
classname - is the name of the calling class
method - is the name of the calling method
return_arg - is the value being returned by the calling method

exit

public void exit(String classname,
                 String method,
                 boolean return_arg)
Reports the exit from a method.

Supported API: false

Parameters:
classname - is the name of the calling class
method - is the name of the calling method
return_arg - is the value being returned by the calling method

exit

public void exit(String classname,
                 String method,
                 byte return_arg)
Reports the exit from a method.

Supported API: false

Parameters:
classname - is the name of the calling class
method - is the name of the calling method
return_arg - is the value being returned by the calling method

exit

public void exit(String classname,
                 String method,
                 char return_arg)
Reports the exit from a method.

Supported API: false

Parameters:
classname - is the name of the calling class
method - is the name of the calling method
return_arg - is the value being returned by the calling method

exit

public void exit(String classname,
                 String method,
                 short return_arg)
Reports the exit from a method.

Supported API: false

Parameters:
classname - is the name of the calling class
method - is the name of the calling method
return_arg - is the value being returned by the calling method

exit

public void exit(String classname,
                 String method,
                 int return_arg)
Reports the exit from a method.

Supported API: false

Parameters:
classname - is the name of the calling class
method - is the name of the calling method
return_arg - is the value being returned by the calling method

exit

public void exit(String classname,
                 String method,
                 long return_arg)
Reports the exit from a method.

Supported API: false

Parameters:
classname - is the name of the calling class
method - is the name of the calling method
return_arg - is the value being returned by the calling method

exit

public void exit(String classname,
                 String method,
                 float return_arg)
Reports the exit from a method.

Supported API: false

Parameters:
classname - is the name of the calling class
method - is the name of the calling method
return_arg - is the value being returned by the calling method

exit

public void exit(String classname,
                 String method,
                 double return_arg)
Reports the exit from a method.

Supported API: false

Parameters:
classname - is the name of the calling class
method - is the name of the calling method
return_arg - is the value being returned by the calling method

dump

public void dump(Object object)
Reports a dump of the state of an object. Makes use of the Dumpable API, if it is implemented by the object, otherwise uses DumpUtil for a general state dump implementation.

Supported API: false

Parameters:
object - the object to identify

identify

public void identify(Object object)
Reports the identity of an object. That is, the toString() representation of an object.

Supported API: false

Parameters:
object - the object to identify

exception

public void exception(Throwable exception)
Reports the String representation of the exception.

Supported API: false

Parameters:
exception - the exception/throwable to report.

exception

public void exception(Throwable exception,
                      boolean stack_trace)
Reports the String representation of the exception and prints its stack trace.

Supported API: false

Parameters:
exception - the exception/throwable to report.
stack_trace - if true, will print the stack trace from the exception.

printStackTrace

public void printStackTrace(String message)
Reports a stack trace, after printing passed message.

Supported API: false

Parameters:
message - a message to print prior to the stack trace.

setLogFile

public void setLogFile(String name,
                       boolean append,
                       boolean tee,
                       int iterations,
                       String date_format,
                       boolean add_thread)
Deprecated.  

Sets the log file output parameters. If this object is already pointing to a log file, it will be redirected based on the parameters. If the file name passed is the same as log file already pointed to, none of the parameters will be changed.

Supported API: true

Parameters:
name - the name of the log file, including full directory specification.
append - if true, opens the log file in append mode.
tee - if true, will also send all output to standard output
iterations - if a value greater than zero is passed, will iterate file name up to the number specified. (e.g. file1, file2, file3...)
date_format - if a date format is passed, it will be used in prefixing each line with a time stamp; if nothing is provided, the lines will not be prefixed with a time stamp.
add_thread - if true, each output line will include the name of the thread being executed.

setLogFile

public void setLogFile(String name,
                       boolean append,
                       boolean tee,
                       int iterations,
                       String date_format,
                       boolean add_thread,
                       boolean verbose)
Sets the log file output parameters. If this object is already pointing to a log file, it will be redirected based on the parameters. If the file name passed is the same as log file already pointed to, none of the parameters will be changed.

Supported API: true

Parameters:
name - the name of the log file, including full directory specification.
append - if true, opens the log file in append mode.
tee - if true, will also send all output to standard output
iterations - if a value greater than zero is passed, will iterate file name up to the number specified. (e.g. file1, file2, file3...)
date_format - if a date format is passed, it will be used in prefixing each line with a time stamp; if nothing is provided, the lines will not be prefixed with a time stamp.
add_thread - if true, each output line will include the name of the thread being executed.
verbose - if true, will use the most verbose option for info reporting, but may only apply to certain method.

finalize

protected void finalize()

iteratedFilename

private String iteratedFilename(String name,
                                int iterations)

printStackTrace

private void printStackTrace(Throwable stackAccess)

toString

public String toString()