com.townleyenterprises.trace
Class ErrorTrace

java.lang.Object
  extended bycom.townleyenterprises.trace.TraceCore
      extended bycom.townleyenterprises.trace.MethodTrace
          extended bycom.townleyenterprises.trace.ErrorTrace

public class ErrorTrace
extends MethodTrace

This class implements generic trace facilities. The general usage should be for classes who will support tracing to implement the Traceable interface and then create a static attribute which will be used for trace messages of that class.

The maturity level of the class to be traced may be specified, allowing author-defined filtering of trace messages for classes that have been more exhaustively tested. The maturity level specifies the trace threshold at which messages of this class should be displayed.

Since version 3.0, instances of this class are now independently controlable for the trace level. This means that certain classes can be always disabled, even if they are fully instrumented.

This class is now thread safe.

Since:
1.0
Version:
$Id: ErrorTrace.java,v 1.1 2004/11/27 17:32:50 atownley Exp $
Author:
Andrew S. Townley

Field Summary
 
Fields inherited from class com.townleyenterprises.trace.MethodTrace
TRACE_ARG_GEN_FMT, TRACE_ARG_STR_FMT, TRACE_RETURN_FMT, TRACE_RETURN_GEN_FMT, TRACE_RETURN_STR_FMT, TRACE_START_FMT, TRACE_THROW_FMT
 
Constructor Summary
ErrorTrace()
          This is the empty constructor for an ErrorTrace instance.
ErrorTrace(java.lang.String className)
          Helper method for the default maturity level
ErrorTrace(java.lang.String className, int maturity)
          This is the normal constructor for the ErrorTrace class that allows specification of the class name to be traced and also allows setting the maturity level.
 
Method Summary
 void methodReturn()
          This method should be called to specify that the method is about to return, with no value.
 boolean methodReturn(boolean arg)
           
 double methodReturn(double arg)
           
 long methodReturn(long arg)
           
 java.lang.Object methodReturn(java.lang.Object arg)
           
 java.lang.String methodReturn(java.lang.String arg)
          This method should be called to specify that the method is about to return, with the indicated value.
 Traceable methodReturn(Traceable arg)
           
 java.lang.Throwable methodThrow(java.lang.Throwable ex, boolean print)
          This method is used to specify that the method is about to throw an exception.
 
Methods inherited from class com.townleyenterprises.trace.MethodTrace
methodArg, methodArg, methodArg, methodArg, methodArg, methodArg, methodArgs, methodReturn, methodReturn, methodStart, methodStart, methodStart, methodThrow, popCurrentMethod
 
Methods inherited from class com.townleyenterprises.trace.TraceCore
getInstanceTraceLevel, getShowThreadNameAlways, getShowTimestamp, getTimestampFormat, getTraceFile, getTraceLevel, getTraceLevel, getTraceStream, loadInstanceSettings, loadSettings, printStackTrace, setInstanceTraceLevel, setShowThreadNameAlways, setShowTimestamp, setTimestampFormat, setTraceFile, setTraceLevel, setTraceLevel, tprintln, tprintln, willTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ErrorTrace

public ErrorTrace()
This is the empty constructor for an ErrorTrace instance. It assigns some defaults for all the attributes. The classname is undefined, and the maturity level will be 0.


ErrorTrace

public ErrorTrace(java.lang.String className)
Helper method for the default maturity level

Parameters:
className - the name to appear in the logs

ErrorTrace

public ErrorTrace(java.lang.String className,
                  int maturity)
This is the normal constructor for the ErrorTrace class that allows specification of the class name to be traced and also allows setting the maturity level.

Parameters:
className - the name to appear in the trace logs
maturity - the maturity level of the class
Method Detail

methodReturn

public void methodReturn()
Description copied from class: MethodTrace
This method should be called to specify that the method is about to return, with no value.

Overrides:
methodReturn in class MethodTrace

methodReturn

public java.lang.String methodReturn(java.lang.String arg)
Description copied from class: MethodTrace
This method should be called to specify that the method is about to return, with the indicated value.

Overrides:
methodReturn in class MethodTrace

methodReturn

public boolean methodReturn(boolean arg)
Overrides:
methodReturn in class MethodTrace

methodReturn

public double methodReturn(double arg)
Overrides:
methodReturn in class MethodTrace

methodReturn

public long methodReturn(long arg)
Overrides:
methodReturn in class MethodTrace

methodReturn

public Traceable methodReturn(Traceable arg)
Overrides:
methodReturn in class MethodTrace

methodReturn

public java.lang.Object methodReturn(java.lang.Object arg)
Overrides:
methodReturn in class MethodTrace

methodThrow

public java.lang.Throwable methodThrow(java.lang.Throwable ex,
                                       boolean print)
Description copied from class: MethodTrace
This method is used to specify that the method is about to throw an exception.

Overrides:
methodThrow in class MethodTrace
Parameters:
ex - the exception that is to be thrown
print - if true, print the stack trace of the exception automatically.
Returns:
the throwable instance is returned from this method in order to reduce programming errors.


Copyright © 2002-2004, Andrew S. Townley and Townley Enterprises. All Rights Reserved.
This project is hosted on http://te-code.sourceforge.net.