TraceKt
public final class TraceKt
Summary
Public methods |
|
|---|---|
static final @NonNull T |
Wrap the specified |
static final @NonNull T |
<T extends Object> trace(Wrap the specified |
static final @NonNull T |
<T extends Object> traceAsync(Wrap the specified |
static final @NonNull T |
<T extends Object> traceAsync(Wrap the specified |
Public methods
trace
public static final @NonNull T <T extends Object> trace(@NonNull String label, @NonNull Function0<@NonNull T> block)
Wrap the specified block in calls to Trace.beginSection (with the supplied label) and Trace.endSection.
trace
public static final @NonNull T <T extends Object> trace(
@NonNull Function0<@NonNull String> lazyLabel,
@NonNull Function0<@NonNull T> block
)
Wrap the specified block in calls to Trace.beginSection (with a lazy-computed lazyLabel, only if tracing is enabled - Trace.isEnabled) and Trace.endSection.
This variant allows you to build a dynamic label, but only when tracing is enabled, avoiding the cost of String construction otherwise.
traceAsync
public static final @NonNull T <T extends Object> traceAsync(
@NonNull Function0<@NonNull String> lazyMethodName,
@NonNull Function0<@NonNull Integer> lazyCookie,
@NonNull Function0<@NonNull T> block
)
Wrap the specified block in calls to Trace.beginAsyncSection and Trace.endAsyncSection, with a lazy-computed lazyMethodName and lazyCookie, only if tracing is enabled - Trace.isEnabled.
| Parameters | |
|---|---|
@NonNull Function0<@NonNull String> lazyMethodName |
The method name to appear in the trace, computed lazily if needed. |
@NonNull Function0<@NonNull Integer> lazyCookie |
Unique identifier for distinguishing simultaneous events, computed lazily if needed. |
@NonNull Function0<@NonNull T> block |
a code block to be wrapped between |
traceAsync
public static final @NonNull T <T extends Object> traceAsync(
@NonNull String methodName,
int cookie,
@NonNull SuspendFunction0<@NonNull T> block
)
Wrap the specified block in calls to Trace.beginAsyncSection (with the supplied methodName and cookie) and Trace.endAsyncSection.
| Parameters | |
|---|---|
@NonNull String methodName |
The method name to appear in the trace. |
int cookie |
Unique identifier for distinguishing simultaneous events |
@NonNull SuspendFunction0<@NonNull T> block |
A code block to be wrapped between |