Open sandboxFocus

Method LogActivityAsync

LogActivityAsync<TDescription>(in TDescription, Func<Task>, in OpenActivityOptions)

Executes an asynchronous void delegate and logs its execution.

Declaration
public Task LogActivityAsync<TDescription>(in TDescription description, Func<Task> action, in OpenActivityOptions options = default) where TDescription : IMessage
Parameters
Type Name Description
TDescription description

The activity description, typically created using the SemanticMessageBuilder or FormattedMessageBuilder class.

Func<Task> action

The action be be executed.

OpenActivityOptions options

Options.

Returns
Type Description
Task

The Task.

Type Parameters
Name Description
TDescription

The type of the description message.

LogActivityAsync<TDescription, TResult>(in TDescription, Func<Task<TResult>>, in OpenActivityOptions)

Executes an asynchronous non-void delegate and logs its execution.

Declaration
public Task<TResult> LogActivityAsync<TDescription, TResult>(in TDescription description, Func<Task<TResult>> action, in OpenActivityOptions options = default) where TDescription : IMessage
Parameters
Type Name Description
TDescription description

The activity description, typically created using the SemanticMessageBuilder or FormattedMessageBuilder class.

Func<Task<TResult>> action

The action be be executed.

OpenActivityOptions options

Options.

Returns
Type Description
Task<TResult>

A Task<TResult> whose result will be set to the result of action.

Type Parameters
Name Description
TDescription

The type of the description message.

TResult

The type of the return value of the action to execute.