|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.townleyenterprises.trace.TraceCore
This class represents the core of the original ErrorTrace class and contains the basic management of the trace facilities. Additionally, since it is being essentially reimplemented (again), it now supports a lot more fine-grained configuration options to allow the output to be controlled at run-time.
Constructor Summary | |
protected |
TraceCore(java.lang.String name,
int maturity)
The constructor restricts creation of direct instances of the class except by subclasses. |
Method Summary | |
int |
getInstanceTraceLevel()
This method returns the trace level for this specific instance. |
static boolean |
getShowThreadNameAlways()
Accessor to tell if we're displaying the thread name. |
static boolean |
getShowTimestamp()
Accessor to tell if we're displaying the timestamp. |
static java.lang.String |
getTimestampFormat()
Accessor for the timestamp format string. |
static java.lang.String |
getTraceFile()
This is the attribute accessor for the current trace file name. |
static int |
getTraceLevel()
This is the attribute accessor for the current global trace level for all instances. |
static int |
getTraceLevel(java.lang.String name)
This is the attribute accessor to retrieve the current trace level for the given trace object. |
static java.io.PrintStream |
getTraceStream()
This method returns a reference to the underlying trace PrintStream. |
void |
loadInstanceSettings(java.lang.String name,
java.util.Properties props)
This method is used to allow the instance to load the settings once it has been created. |
static void |
loadSettings(java.util.Properties props)
This method is used to load all of the configuration settings for ErrorTrace from the specified set of Properties. |
void |
printStackTrace(int threshold,
java.lang.Throwable ex)
This method is used to print the exception's stack trace to the trace log. |
void |
setInstanceTraceLevel(int l)
This method is used to set the instance trace level for this object. |
static void |
setShowThreadNameAlways(boolean x)
Setter for showing the thread name. |
static void |
setShowTimestamp(boolean x)
Setter for the timestamp. |
static void |
setTimestampFormat(java.lang.String fmt)
|
static void |
setTraceFile(java.lang.String filename,
boolean append)
This method is used to set the global trace file name for all objects. |
static void |
setTraceLevel(int l)
This method is used to set the global trace level for all objects. |
static void |
setTraceLevel(java.lang.String name,
int l)
This method is used to set the specific trace level for the named trace object. |
void |
tprintln(int threshold,
java.lang.String fmt)
This is a short-hand way to call the tprintln method if no arguments are needed. |
void |
tprintln(int threshold,
java.lang.String fmt,
java.lang.Object[] args)
This method is a generic method that is used by all of the other, simpler methods. |
boolean |
willTrace(int threshold)
This method can be used to determine if trace messages will be printed for a certain threshold value. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected TraceCore(java.lang.String name, int maturity)
name
- the name of the class being tracedmaturity
- the maturity level of the class being
tracedMethod Detail |
public void printStackTrace(int threshold, java.lang.Throwable ex)
threshold
- the trace threshold to printex
- the exception to dumppublic void tprintln(int threshold, java.lang.String fmt, java.lang.Object[] args)
threshold
- the threshold at which the message should
be tracedfmt
- the message format stringargs
- any arguments to the message formatpublic void tprintln(int threshold, java.lang.String fmt)
threshold
- the threshold at which the message should
be tracedfmt
- the message to be printedpublic boolean willTrace(int threshold)
if(willTrace(10)) { for(int i = 0; i < arr.length; ++i) { tprintln(10, "arr[" + i + "] = " + arr[i]); } }
public static int getTraceLevel()
public static int getTraceLevel(java.lang.String name)
name
- the name of the trace object
public int getInstanceTraceLevel()
public static void setTraceLevel(int l)
l
- the new trace levelpublic static void setTraceLevel(java.lang.String name, int l)
name
- the named objectl
- the new trace levelpublic void setInstanceTraceLevel(int l)
l
- the new trace levelpublic static java.io.PrintStream getTraceStream()
public static boolean getShowTimestamp()
public static void setShowTimestamp(boolean x)
public static boolean getShowThreadNameAlways()
public static void setShowThreadNameAlways(boolean x)
public static java.lang.String getTimestampFormat()
public static void setTimestampFormat(java.lang.String fmt)
public static java.lang.String getTraceFile()
public static void setTraceFile(java.lang.String filename, boolean append)
filename
- the name of the trace fileappend
- true to append to existing filepublic static void loadSettings(java.util.Properties props)
props
- the properties to use to configure the trace
utility.public void loadInstanceSettings(java.lang.String name, java.util.Properties props)
props
- the properties
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |