Class TraceCompassLogUtils.ScopeLog
java.lang.Object
org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils.ScopeLog
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
- TraceCompassLogUtils
Scope Logger helper. This will automatically log entry and exit of the
scope. This scope log will be shown under any scope enclosing it, but
will not be the source, or destination of any link to other scopes. If
relations should be done with other scopes, the
TraceCompassLogUtils.FlowScopeLog
class is more appropriate.
Usage:
usage of ScopeLog
try (ScopeLog linksLogger = new ScopeLog(LOGGER, Level.CONFIG, "Perform Query")) { //$NON-NLS-1$
ss.updateAllReferences();
dataStore.addAll(ss.query(ts, trace));
}
will generate the following trace
trace output
INFO: {"ts":12345,"ph":"B",tid:1,"name:Perform Query"}
INFO: {"ts":"12366,"ph":"E","tid":1}
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
ScopeLog
Scope logger constructor- Parameters:
log- the JUL logger to log tolevel- the log level seeLevellabel- The label of the event pairargs- Additional messages to pass for this scope, should be in pairs key, value, key2, value2.... typically arguments. Note that these arguments will be logged only at the beginning of the scope
-
-
Method Details
-
addData
Add a tag to the scope logger, will be written at the exit. This can save space on the trace by having a field appended to an event rather than writing a whole new event for a small chunk of data. If the timing information is important than it would be more appropriate to callTraceCompassLogUtils.traceInstant(Logger, Level, String, Object...)- Parameters:
name- the name of the fieldvalue- The value of the field.
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-