PostSharp.ILAPI ReferencePost­Sharp.​Patterns.​Diagnostics.​CustomLog­Level­SourceLog­Activity
Open sandboxFocus

LogLevelSource.LogActivity Method

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 = null)
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>(in TDescription, Action, in OpenActivityOptions, ref CallerInfo)

Declaration
public void LogActivity<TDescription>(in TDescription description, [Required] Action action, in OpenActivityOptions options, ref CallerInfo callerInfo)
where TDescription : IMessage
Parameters
Type Name Description
TDescription description
Action action
OpenActivityOptions options
CallerInfo callerInfo
Type Parameters
Name Description
TDescription

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

Executes a System.Func<> and logs its execution.

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

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

System.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.

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

Declaration
public TResult LogActivity<TDescription, TResult>(in TDescription description, [Required] Func<TResult> action, in OpenActivityOptions options, ref CallerInfo callerInfo)
where TDescription : IMessage
Parameters
Type Name Description
TDescription description
System.Func<TResult> action
OpenActivityOptions options
CallerInfo callerInfo
Returns
Type Description
TResult
Type Parameters
Name Description
TDescription
TResult