|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.townleyenterprises.trace.TraceCore com.townleyenterprises.trace.MethodTrace
This class augments the trace core with a way to track the name of the currently traced method. This class is now thread safe.
Field Summary | |
static java.lang.String |
TRACE_ARG_GEN_FMT
This is the message format for method other method arguments |
static java.lang.String |
TRACE_ARG_STR_FMT
This is the message format for method arguments that are strings |
static java.lang.String |
TRACE_RETURN_FMT
This is the message format used for methods that return no values |
static java.lang.String |
TRACE_RETURN_GEN_FMT
This is the message format used for methods returning object values |
static java.lang.String |
TRACE_RETURN_STR_FMT
This is the message format used for methods returning string values |
static java.lang.String |
TRACE_START_FMT
This is the message format used for method start |
static java.lang.String |
TRACE_THROW_FMT
This is the message format for throwing exceptions |
Constructor Summary | |
protected |
MethodTrace(java.lang.String name,
int maturity)
The constructor initializes the trace core instance as well as setting the default value for method information to 1. |
protected |
MethodTrace(java.lang.String name,
int maturity,
int methodTraceLevel)
The constructor initializes the trace core instance as well as specifies the default value at which the method information should be printed. |
Method Summary | |
void |
methodArg(java.lang.String name,
boolean arg)
|
void |
methodArg(java.lang.String name,
double arg)
|
void |
methodArg(java.lang.String name,
int arg)
|
void |
methodArg(java.lang.String name,
java.lang.Object arg)
|
void |
methodArg(java.lang.String name,
java.lang.String arg)
This method should be called to specify a method argument parameter. |
void |
methodArg(java.lang.String name,
Traceable arg)
|
void |
methodArgs(java.lang.String[] pnames,
java.lang.Object[] params)
|
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)
|
float |
methodReturn(float arg)
|
int |
methodReturn(int 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)
|
void |
methodStart(java.lang.String name)
This method should be called at the beginning of each method to be traced with the method name. |
void |
methodStart(java.lang.String name,
java.lang.Object[] params)
This version of methodStart prints all of the arguments without the parameter names. |
void |
methodStart(java.lang.String name,
java.lang.String[] pnames,
java.lang.Object[] params)
This version of methodStart prints all of the arguments together with the parameter names. |
void |
methodThrow(java.lang.Throwable ex)
This method is used to specify that the method is about to throw an exception. |
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. |
protected java.lang.String |
popCurrentMethod()
This method is used to pop the method name off the stack |
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 |
Field Detail |
public static final java.lang.String TRACE_START_FMT
public static final java.lang.String TRACE_RETURN_FMT
public static final java.lang.String TRACE_RETURN_GEN_FMT
public static final java.lang.String TRACE_RETURN_STR_FMT
public static final java.lang.String TRACE_ARG_STR_FMT
public static final java.lang.String TRACE_ARG_GEN_FMT
public static final java.lang.String TRACE_THROW_FMT
Constructor Detail |
protected MethodTrace(java.lang.String name, int maturity, int methodTraceLevel)
methodTraceLevel
- set the level when the method
information is printed (default is 1)protected MethodTrace(java.lang.String name, int maturity)
Method Detail |
public void methodStart(java.lang.String name)
name
- the name of the method, without the '()'public void methodStart(java.lang.String name, java.lang.String[] pnames, java.lang.Object[] params)
name
- the method namepnames
- the parameter namesparams
- the parameterspublic void methodStart(java.lang.String name, java.lang.Object[] params)
name
- the method nameparams
- the parameterspublic void methodArg(java.lang.String name, java.lang.String arg)
name
- the parameter namearg
- the parameter valuepublic void methodArg(java.lang.String name, int arg)
public void methodArg(java.lang.String name, boolean arg)
public void methodArg(java.lang.String name, double arg)
public void methodArg(java.lang.String name, Traceable arg)
public void methodArg(java.lang.String name, java.lang.Object arg)
public void methodArgs(java.lang.String[] pnames, java.lang.Object[] params)
public void methodReturn()
public java.lang.String methodReturn(java.lang.String arg)
public boolean methodReturn(boolean arg)
public float methodReturn(float arg)
public double methodReturn(double arg)
public int methodReturn(int arg)
public long methodReturn(long arg)
public Traceable methodReturn(Traceable arg)
public java.lang.Object methodReturn(java.lang.Object arg)
public void methodThrow(java.lang.Throwable ex)
ex
- the exception that is to be thrownpublic java.lang.Throwable methodThrow(java.lang.Throwable ex, boolean print)
ex
- the exception that is to be thrownprint
- if true, print the stack trace of the
exception automatically.
protected java.lang.String popCurrentMethod()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |