Skip to content

Class Trace

Definition

Namespace: StardewUI.Diagnostics
Assembly: StardewUI.dll

Provides methods to toggle tracing and write to the current trace.

public static class Trace

Inheritance
Object ⇦ Trace

Members

Properties

Name Description
IsTracing Gets or sets whether tracing is active.

Methods

Name Description
Begin(string) Begins tracking a new operation (slice).
Begin(Func<string>, string) Begins tracking a new operation (slice).
Begin(Object, string) Begins tracking a new operation (slice).

Details

Properties

IsTracing

Gets or sets whether tracing is active.

public static bool IsTracing { get; set; }
Property Value

Boolean

Remarks

While inactive, all calls to any of the Begin(string) overloads are ignored and return null. If tracing is active, then setting this to false will cause the trace file to be written automatically.


Methods

Begin(string)

Begins tracking a new operation (slice).

public static System.IDisposable Begin(string name);
Parameters

name   string
The name that should appear in the trace log/visualization.

Returns

IDisposable

A disposable instance which, when disposed, stops tracking this operation and records the duration it took, for subsequent writing to the trace file.

Remarks

Slices must be disposed in the opposite order in which they are created, otherwise the final trace may be considered invalid.


Begin(Func<string>, string)

Begins tracking a new operation (slice).

public static System.IDisposable Begin(Func<string> callerName, string memberName);
Parameters

callerName   Func<string>
Reference to the name (e.g. type name) of the object performing the traced operation.

memberName   string
Name of the member (method or property) about to begin execution.

Returns

IDisposable

A disposable instance which, when disposed, stops tracking this operation and records the duration it took, for subsequent writing to the trace file.

Remarks

Slices must be disposed in the opposite order in which they are created, otherwise the final trace may be considered invalid.


Begin(Object, string)

Begins tracking a new operation (slice).

public static System.IDisposable Begin(System.Object caller, string memberName);
Parameters

caller   Object
Reference to the object performing the traced operation.

memberName   string
Name of the member (method or property) about to begin execution.

Returns

IDisposable

A disposable instance which, when disposed, stops tracking this operation and records the duration it took, for subsequent writing to the trace file.

Remarks

Slices must be disposed in the opposite order in which they are created, otherwise the final trace may be considered invalid.