Open sandboxFocus

Class LogActivity

Represents a logged custom activity, i.e. something that a beginning and an end with a specific outcome. This class is instantiated by the legacy API of the Logger class. For the modern API, see LogActivity<TActivityDescription>.

Inheritance
LogActivity
Implements
Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common.dll
Syntax
[RequirePostSharp("PostSharp.Patterns.Common.Weaver", "AddCallerInfoTask", AnyTypeReference = true)]
public class LogActivity : Logger, IDisposable

Constructors

Name Description
LogActivity(ILogger, ILoggingContext)

Initializes a new LogActivity.

Properties

Name Description
Context

Gets the ILoggingContext created from the current LogActivity.

IsValid

Determines whether the current LogActivity is valid, i.e. calls to methods SetFailure() or SetException(Exception) will do something, or will be totally ignored.

Methods

Name Description
Dispose()
Dispose(bool)

Disposes the current LogActivity.

Resume()

Resumes the current async activity after it has been suspended by a call to Suspend(). There is typically no need to invoke this method in user code because all async methods that use the Logger class are automatically instrumented.

SetException(Exception)

Ends an activity (opened with OpenActivity(string) or OpenAsyncActivity(string) with a given Exception.

SetFailure()

Ends an activity (opened with OpenActivity(string) or OpenAsyncActivity(string) with failure with the default failure message.

SetFailure(string)

Ends an activity (opened with OpenActivity(string) or OpenAsyncActivity(string) with failure and specifies a parameterless failure message.

SetFailure(string, params object[])

Ends an activity (opened with OpenActivity(string) or OpenAsyncActivity(string) with failure and specifies a failure message with an array of parameters.

SetFailure<T1>(string, T1)

Ends an activity (opened with OpenActivity(string) or OpenAsyncActivity(string) with failure and specifies a failure message with 1 parameter.

SetFailure<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(string, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

Ends an activity (opened with OpenActivity(string) or OpenAsyncActivity(string) with failure and specifies a failure message with 10 parameters.

SetFailure<T1, T2>(string, T1, T2)

Ends an activity (opened with OpenActivity(string) or OpenAsyncActivity(string) with failure and specifies a failure message with 2 parameters.

SetFailure<T1, T2, T3>(string, T1, T2, T3)

Ends an activity (opened with OpenActivity(string) or OpenAsyncActivity(string) with failure and specifies a failure message with 3 parameters.

SetFailure<T1, T2, T3, T4>(string, T1, T2, T3, T4)

Ends an activity (opened with OpenActivity(string) or OpenAsyncActivity(string) with failure and specifies a failure message with 4 parameters.

SetFailure<T1, T2, T3, T4, T5>(string, T1, T2, T3, T4, T5)

Ends an activity (opened with OpenActivity(string) or OpenAsyncActivity(string) with failure and specifies a failure message with 5 parameters.

SetFailure<T1, T2, T3, T4, T5, T6>(string, T1, T2, T3, T4, T5, T6)

Ends an activity (opened with OpenActivity(string) or OpenAsyncActivity(string) with failure and specifies a failure message with 6 parameters.

SetFailure<T1, T2, T3, T4, T5, T6, T7>(string, T1, T2, T3, T4, T5, T6, T7)

Ends an activity (opened with OpenActivity(string) or OpenAsyncActivity(string) with failure and specifies a failure message with 7 parameters.

SetFailure<T1, T2, T3, T4, T5, T6, T7, T8>(string, T1, T2, T3, T4, T5, T6, T7, T8)

Ends an activity (opened with OpenActivity(string) or OpenAsyncActivity(string) with failure and specifies a failure message with 8 parameters.

SetFailure<T1, T2, T3, T4, T5, T6, T7, T8, T9>(string, T1, T2, T3, T4, T5, T6, T7, T8, T9)

Ends an activity (opened with OpenActivity(string) or OpenAsyncActivity(string) with failure and specifies a failure message with 9 parameters.

SetSuccess()

Ends an activity (opened with OpenActivity(string) or OpenAsyncActivity(string) with success with the default success message.

SetSuccess(string)

Ends an activity (opened with OpenActivity(string) or OpenAsyncActivity(string) with success and specifies a parameterless success message.

SetSuccess(string, params object[])

Ends an activity (opened with OpenActivity(string) or OpenAsyncActivity(string) with success and specifies a success message with an array of parameters.

SetSuccess<T1>(string, T1)

Ends an activity (opened with OpenActivity(string) or OpenAsyncActivity(string) with success and specifies a success message with 1 parameter.

SetSuccess<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(string, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

Ends an activity (opened with OpenActivity(string) or OpenAsyncActivity(string) with success and specifies a success message with 10 parameters.

SetSuccess<T1, T2>(string, T1, T2)

Ends an activity (opened with OpenActivity(string) or OpenAsyncActivity(string) with success and specifies a success message with 2 parameters.

SetSuccess<T1, T2, T3>(string, T1, T2, T3)

Ends an activity (opened with OpenActivity(string) or OpenAsyncActivity(string) with success and specifies a success message with 3 parameters.

SetSuccess<T1, T2, T3, T4>(string, T1, T2, T3, T4)

Ends an activity (opened with OpenActivity(string) or OpenAsyncActivity(string) with success and specifies a success message with 4 parameters.

SetSuccess<T1, T2, T3, T4, T5>(string, T1, T2, T3, T4, T5)

Ends an activity (opened with OpenActivity(string) or OpenAsyncActivity(string) with success and specifies a success message with 5 parameters.

SetSuccess<T1, T2, T3, T4, T5, T6>(string, T1, T2, T3, T4, T5, T6)

Ends an activity (opened with OpenActivity(string) or OpenAsyncActivity(string) with success and specifies a success message with 6 parameters.

SetSuccess<T1, T2, T3, T4, T5, T6, T7>(string, T1, T2, T3, T4, T5, T6, T7)

Ends an activity (opened with OpenActivity(string) or OpenAsyncActivity(string) with success and specifies a success message with 7 parameters.

SetSuccess<T1, T2, T3, T4, T5, T6, T7, T8>(string, T1, T2, T3, T4, T5, T6, T7, T8)

Ends an activity (opened with OpenActivity(string) or OpenAsyncActivity(string) with success and specifies a success message with 8 parameters.

SetSuccess<T1, T2, T3, T4, T5, T6, T7, T8, T9>(string, T1, T2, T3, T4, T5, T6, T7, T8, T9)

Ends an activity (opened with OpenActivity(string) or OpenAsyncActivity(string) with success and specifies a success message with 9 parameters.

Suspend()

Suspends the current async activity. The activity must than be resumed by a call of the Resume() method. There is typically no need to invoke this method in user code because all async methods that use the Logger class are automatically instrumented.