Trace
Call Signature¶
trace(
label:string,values?:Record<string,unknown>):void
Records a point in your code, with optional named values, so you can inspect it without a breakpoint.
When tracing is available, such as in a UiPath coded function, the marker is added to the trace. Otherwise it is
printed with console.debug. trace never throws.
A marker can include the values you pass and the local variables of the calling function, so do not trace secrets or personal data.
Parameters¶
| Parameter | Type | Description |
|---|---|---|
label |
string |
A short name for this point in the code |
values? |
Record<string, unknown> |
Named values to record with the marker |
Returns¶
void
Example¶
import { trace } from '@uipath/uipath-typescript/core';
trace('after-total', { orderId: '<orderId>', total });
Call Signature¶
trace<
This,Method>(method:Method,context:ClassMethodDecoratorContext<This>):Method
Records every call of a class method, with its arguments and its result or error. Apply it without parentheses.
When tracing is available, each call is added to the trace, and markers recorded during the call appear under it.
Otherwise each call is printed with console.debug. The method behaves exactly as before.
Arguments and results are recorded in full, so do not decorate methods that handle secrets or personal data.
Type Parameters¶
| Type Parameter | Description |
|---|---|
This |
The class the method belongs to |
Method extends AnyMethod<This> |
The type of the decorated method |
Parameters¶
| Parameter | Type | Description |
|---|---|---|
method |
Method |
The decorated method |
context |
ClassMethodDecoratorContext<This> |
The decorator context for the method |
Returns¶
Method
The method, wrapped so that each call is recorded
Example¶
import { trace } from '@uipath/uipath-typescript/core';
class ApprovalPolicy {
@trace
approve(total: number): boolean {
return total <= 1000;
}
}
Call Signature¶
trace<
T>(target:object,propertyKey:string|symbol,descriptor:TypedPropertyDescriptor<T>):TypedPropertyDescriptor<T>
The same method decorator, for projects compiled with experimentalDecorators.
Type Parameters¶
| Type Parameter | Description |
|---|---|
T |
The type of the decorated method |
Parameters¶
| Parameter | Type | Description |
|---|---|---|
target |
object |
The class, or its prototype, that declares the method |
propertyKey |
string | symbol |
The name of the decorated method |
descriptor |
TypedPropertyDescriptor<T> |
The property descriptor of the decorated method |
Returns¶
TypedPropertyDescriptor<T>
The descriptor, with the method wrapped so that each call is recorded