Package com.adobe.xfa.ut.trace
Class TraceHandler
- java.lang.Object
-
- com.adobe.xfa.ut.trace.TraceHandler
-
public final class TraceHandler extends java.lang.Object
This trace handler class manages Trace areas for a given thread and outputs trace messages to standard out. If an application uses tracing it should create one instance of this class for each thread.example: Trace dataTrace = new Trace("data", ResId.DataTraceHelp); Trace stringTrace = new Trace("string" ResId.StringTraceHelp); main(...) { TraceHandler traceHandler = new TraceHandler(); TraceHandler.registerTraceHandler(traceHandler); // three ways to activate traceHandler.activate("data", 2); traceHandler.activate("data:2 eval:3 signature:1"); stringTrace.activate(3); ... traceHandler.trace(dataTrace, 2, 27, "data msg"); // issue message ... dataTrace.trace(2, 33, "string msg"); // issue message ... }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
TraceHandler.AmendMsgCallback
static class
TraceHandler.TimingType
-
Constructor Summary
Constructors Constructor Description TraceHandler(int nThreadId)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activate(Trace trace, int nLevel)
Activates a trace sectionvoid
activate(java.lang.String sNamesAndLevels)
Activates one or more trace sectionsvoid
activate(java.lang.String sName, int nLevel)
Activates a trace sectionvoid
deactivate(java.lang.String sName)
Deactivates a trace sectionint
getThreadId()
Get the thread ID of this TraceHandlerstatic long
getTimerMilliseconds(TraceHandler.TimingType eType)
static TraceHandler
getTraceHandler()
Get the TraceHandler for the current thread.static void
initializeTiming()
boolean
isTimerActive(TraceHandler.TimingType eType)
static void
registerTraceHandler(TraceHandler traceHandler)
Registers the trace handler for the current thread.static void
reportScriptInfo(java.lang.String sMsg)
static void
reportTimingResults(boolean bClearStoppedTimers)
static void
resetTiming()
static void
resetTiming(TraceHandler.TimingType eType)
static boolean
scriptLoggingEnabled()
static void
setAmendMsgCallback(TraceHandler.AmendMsgCallback callback, java.lang.Object userData)
static boolean
timingTraceEnabled()
static void
timingTraceEnabled(boolean bEnabled)
static void
unregisterTraceHandler()
Unregisters a trace handler for the current thread.
-
-
-
Method Detail
-
timingTraceEnabled
public static void timingTraceEnabled(boolean bEnabled)
-
timingTraceEnabled
public static boolean timingTraceEnabled()
-
scriptLoggingEnabled
public static boolean scriptLoggingEnabled()
-
setAmendMsgCallback
public static void setAmendMsgCallback(TraceHandler.AmendMsgCallback callback, java.lang.Object userData)
-
resetTiming
public static void resetTiming()
-
resetTiming
public static void resetTiming(TraceHandler.TimingType eType)
-
initializeTiming
public static void initializeTiming()
-
reportScriptInfo
public static void reportScriptInfo(java.lang.String sMsg)
-
reportTimingResults
public static void reportTimingResults(boolean bClearStoppedTimers)
-
getTimerMilliseconds
public static long getTimerMilliseconds(TraceHandler.TimingType eType)
-
getTraceHandler
public static TraceHandler getTraceHandler()
Get the TraceHandler for the current thread.- Returns:
- the TraceHandler assigned to the current thread.
-
registerTraceHandler
public static void registerTraceHandler(TraceHandler traceHandler)
Registers the trace handler for the current thread.
-
unregisterTraceHandler
public static void unregisterTraceHandler()
Unregisters a trace handler for the current thread.
-
activate
public void activate(Trace trace, int nLevel)
Activates a trace section- Parameters:
trace
- a globally defined Trace objectnLevel
- the detail level of the messages allowed, higher the level greater the detail
-
activate
public void activate(java.lang.String sName, int nLevel)
Activates a trace section- Parameters:
sName
- the name of a globally defined Trace objectnLevel
- the detail level of the messages allowed higher the level greater the detail
-
activate
public void activate(java.lang.String sNamesAndLevels)
Activates one or more trace sections- Parameters:
sNamesAndLevels
- the whitespace-separated list of trace names and the associated detail level. For example: "eval:2 signature:1". This is the same format as a command line argument, so the argument following the -trace argument (by convention) can be passed to this method.
-
deactivate
public void deactivate(java.lang.String sName)
Deactivates a trace section- Parameters:
sName
- the name of a globally defined Trace object
-
getThreadId
public int getThreadId()
Get the thread ID of this TraceHandler- Returns:
- thread ID
-
isTimerActive
public boolean isTimerActive(TraceHandler.TimingType eType)
-
-