PostSharp 6.7 / / Post­Sharp Documentation / API Reference / Post­Sharp.​Patterns.​Diagnostics.​Custom Namespace / Log­Level­Source Class / Log­Level­Source Methods / Log­Level­Source.​Log­Activity Method / Log­Level­Source.​Log­Activity(TDescription, TResult) Method (TDescription, Func(TResult), Open­Activity­Options)

LogLevelSource.LogActivity<TDescription, TResult> Method (TDescription, Func<TResult>, OpenActivityOptions)

Executes a Func<TResult> and logs its execution.

Namespace:  PostSharp.Patterns.Diagnostics.Custom
Assembly:  PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.7.12.0 (6.7.12.0)
Syntax
C#
public TResult LogActivity<TDescription, TResult>(
	 in TDescription description,
	Func<TResult> action,
	 in OpenActivityOptions options = null
)
where TDescription : IMessage

Parameters

description
Type: TDescription
The activity description, typically created using the SemanticMessageBuilder or FormattedMessageBuilder class.
action
Type: System.Func<TResult>
The action be be executed.
options (Optional)
Type: PostSharp.Patterns.Diagnostics.OpenActivityOptions
Options.

Type Parameters

TDescription
The type of the description message.
TResult
The type of the return value of the action to execute.

Return Value

Type: TResult
The return value of action.
See Also