Open sandboxFocus

Method LogActivity

LogActivity<TDescription>(in TDescription, Action, in OpenActivityOptions)

Executes an Action and logs its execution.

Declaration
public void LogActivity<TDescription>(in TDescription description, Action 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.

Action action

The action be be executed.

OpenActivityOptions options

Options.

Type Parameters
Name Description
TDescription

The type of the description message.

LogActivity<TDescription, TResult>(in TDescription, Func<TResult>, in OpenActivityOptions)

Executes a Func<TResult> and logs its execution.

Declaration
public TResult LogActivity<TDescription, TResult>(in TDescription description, Func<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<TResult> action

The action be be executed.

OpenActivityOptions options

Options.

Returns
Type Description
TResult

The return value 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.