Open sandboxFocus
  • TOC

Post­Sharp Documentation

Introduction

Deployment and Configuration

Adding Aspects to Code

Logging

Contracts

INotify­Property­Changed

Weak Event

XAML

Parent/Child, Visitor and Disposable

Undo/Redo

Caching

Multithreading

Developing Custom Aspects

Validating Architecture

Testing and Debugging

Miscellaneous

API Reference

Post­Sharp

Post­Sharp.​Aspects

Post­Sharp.​Aspects.​Advices

Post­Sharp.​Aspects.​Configuration

Post­Sharp.​Aspects.​Dependencies

Post­Sharp.​Aspects.​Internals

Post­Sharp.​Aspects.​Serialization

Post­Sharp.​Collections

Post­Sharp.​Constraints

Post­Sharp.​Extensibility

Post­Sharp.​Extensibility.​Build­Time­Logging

Post­Sharp.​Patterns

Post­Sharp.​Patterns.​Caching

Post­Sharp.​Patterns.​Caching.​Backends

Post­Sharp.​Patterns.​Caching.​Backends.​Azure

Post­Sharp.​Patterns.​Caching.​Backends.​Redis

Post­Sharp.​Patterns.​Caching.​Dependencies

Post­Sharp.​Patterns.​Caching.​Formatters

Post­Sharp.​Patterns.​Caching.​Implementation

Post­Sharp.​Patterns.​Caching.​Locking

Post­Sharp.​Patterns.​Caching.​Serializers

Post­Sharp.​Patterns.​Caching.​Value­Adapters

Post­Sharp.​Patterns.​Collections

Post­Sharp.​Patterns.​Collections.​Advices

Post­Sharp.​Patterns.​Contracts

Post­Sharp.​Patterns.​Diagnostics

Post­Sharp.​Patterns.​Diagnostics.​Adapters.​Asp­Net­Core

Post­Sharp.​Patterns.​Diagnostics.​Adapters.​Asp­Net­Framework

Post­Sharp.​Patterns.​Diagnostics.​Adapters.​Diagnostic­Source

Post­Sharp.​Patterns.​Diagnostics.​Adapters.​Http­Client

Post­Sharp.​Patterns.​Diagnostics.​Audit

Post­Sharp.​Patterns.​Diagnostics.​Backends

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Application­Insights

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Audit

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Common­Logging

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Console

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Event­Source

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Log4Net

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Microsoft

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Multiplexer

Post­Sharp.​Patterns.​Diagnostics.​Backends.​NLog

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Null

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Serilog

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Trace

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Trace­Source

Post­Sharp.​Patterns.​Diagnostics.​Contexts

Post­Sharp.​Patterns.​Diagnostics.​Correlation

Post­Sharp.​Patterns.​Diagnostics.​Custom

Post­Sharp.​Patterns.​Diagnostics.​Custom.​Messages

Post­Sharp.​Patterns.​Diagnostics.​Formatters

Post­Sharp.​Patterns.​Diagnostics.​Record­Builders

Post­Sharp.​Patterns.​Diagnostics.​Threading­Instrumentation

Post­Sharp.​Patterns.​Diagnostics.​Transactions

Post­Sharp.​Patterns.​Diagnostics.​Transactions.​Model

Post­Sharp.​Patterns.​Dynamic­Advising

Post­Sharp.​Patterns.​Formatters

Post­Sharp.​Patterns.​Model

Post­Sharp.​Patterns.​Model.​Controls

Post­Sharp.​Patterns.​Model.​Type­Adapters

Post­Sharp.​Patterns.​Recording

Post­Sharp.​Patterns.​Recording.​Operations

Post­Sharp.​Patterns.​Threading

Post­Sharp.​Patterns.​Threading.​Models

Post­Sharp.​Patterns.​Utilities

Post­Sharp.​Patterns.​Xaml

Post­Sharp.​Reflection

Post­Sharp.​Reflection.​Method­Body

Post­Sharp.​Serialization

  • Article

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.

  • Navigation