PostSharp6.1/API Reference/Post­Sharp.​Patterns.​Diagnostics.​Contexts Namespace/Logging­Context Class

LoggingContext Class

Represents an execution context, typically a method or a user activity.
Inheritance Hierarchy

Namespace:  PostSharp.Patterns.Diagnostics.Contexts
Assembly:  PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.1.23.0 (6.1.23.0)
Syntax
C#
public abstract class LoggingContext : ILoggingContext, 
	IDisposable

The LoggingContext type exposes the following members.

Properties
  NameDescription
Public propertyActivationContext
Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed.
Public propertyBackend
Gets the parent LoggingBackend of the current context.
Public propertyDescription
Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context.
Public propertyId
Gets or set the identifier of the current context. This value is created according to the strategy set in LoggingBackend.Options.ContextIdGenerationStrategy.
Public propertyIdGenerationStrategy
Gets the ContextIdGenerationStrategy used to generate the Id property for the current context.
Public propertyIndentLevel
Gets or sets the indentation level for the current context.
Public propertyIsAsync
Determines whether the current LoggingContext represents an async method or an asynchronous custom activity.
Public propertyIsDisposed
Determines whether the current context has been disposed.
Public propertyIsHidden
Determines whether the current LoggingContext is hidden. Hidden contexts may define properties but should not be rendered.
Public propertyIsSharable
Determines whether the current LoggingContext can be accessed outside of its nominal lifetime (for instance after the method has completed or a custom activity has been closed). Since contexts can be pooled and reused, consumers must call the MakeSharable() method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed.
Public propertyKind
Gets the kind of the current context.
Public propertyMemberName
Gets the name of the method or property related to the current context.
Public propertyParentContext
Gets the LoggingContext that created (initiated) the current context. This is the logical parent.
Public propertySource
Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context.
Public propertySyntheticId
Gets a cross-process globally unique identifier for the current LoggingContext. This value is created according to value of the LoggingBackend.Options.SyntheticIdFormatter property.
Public propertySyntheticParentId
When this property returns a non-null value, the SyntheticId property shall use the value of the SyntheticParentId property as the parent identifier, instead of recursively building the synthetic identifier based on ParentContext. You can set this property when you open a custom activity by configuring the OpenActivityOptions object.
Public propertySyntheticRootId
When this property returns a non-null value, the SyntheticId property shall return the same value as the SyntheticRootId property, instead of starting with the id of the parent context. You can set this property when you open a custom activity by configuring the OpenActivityOptions object.
Public propertyThreadContext
Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed.
Methods
  NameDescription
Public methodCreateCorrelationCookie
Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context.
Public methodDispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Protected methodDispose(Boolean)
Disposes the current object.
Public methodForEachProperty(LoggingPropertyVisitor<Object>, Boolean)
Invokes a delegate for each property defined in the current logging context and optionally in its ancestor contexts.
Public methodForEachProperty<T>(LoggingPropertyVisitor<T>, T, Boolean)
Public methodGetCustomRecordBuilder
Gets a LogRecordBuilder for the current context to build a custom record.
Public methodGetRecordBuilder
Gets a LogRecordBuilder for the current context to build a standard record for a given method.
Public methodMakeSharable
Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool.
Public methodSetCorrelation
Associates the current context with another context.
Public methodSetWaitDependency
Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts.
Public methodToString()
Returns a string that represents the current object.
(Overrides Object.ToString().)
Protected methodToString(StringBuilder)
Formats a description of the current LoggingContext into a given StringBuilder.
See Also