AsyncLoggingContext Class |
A LoggingContext that can represent an async method execution or an async custom activity.
System.Object
PostSharp.Patterns.Diagnostics.Contexts.LoggingContext
PostSharp.Patterns.Diagnostics.Contexts.SuspendableLoggingContext
PostSharp.Patterns.Diagnostics.Contexts.AsyncLoggingContext
PostSharp.Patterns.Diagnostics.Contexts.AsyncCustomActivityLoggingContext
PostSharp.Patterns.Diagnostics.Contexts.AsyncMethodLoggingContext
PostSharp.Patterns.Diagnostics.Contexts.LoggingContext
PostSharp.Patterns.Diagnostics.Contexts.SuspendableLoggingContext
PostSharp.Patterns.Diagnostics.Contexts.AsyncLoggingContext
PostSharp.Patterns.Diagnostics.Contexts.AsyncCustomActivityLoggingContext
PostSharp.Patterns.Diagnostics.Contexts.AsyncMethodLoggingContext
Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 2023.0.3.0 (2023.0.3.0)
C#
public abstract class AsyncLoggingContext : SuspendableLoggingContext
The AsyncLoggingContext type exposes the following members.
Name | Description | |
---|---|---|
ActivationContext |
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.
(Inherited from LoggingContext.) | |
Backend |
Gets the parent LoggingBackend of the current context.
(Inherited from LoggingContext.) | |
CurrentTransaction |
Gets the LoggingTransaction defined or inherited by the current context.
(Inherited from LoggingContext.) | |
DefinedTransaction |
Gets the LoggingTransaction defined by the current context.
(Inherited from LoggingContext.) | |
Description |
Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context.
(Inherited from LoggingContext.) | |
EventData |
Gets the LogEventData (i.e. the source of logging properties) associated with the current LoggingContext.
(Inherited from LoggingContext.) | |
HierarchicalContextIdInfo |
Exposes the IHierarchicalContextIdInfo for the current context. Used by SyntheticIdFormatter.
(Inherited from LoggingContext.) | |
Id |
Gets or set the identifier of the current context. This value is created
according to the strategy set in LoggingBackend.Options.ContextIdGenerationStrategy.
(Inherited from LoggingContext.) | |
IdGenerationStrategy |
Gets the ContextIdGenerationStrategy used to generate the Id property
for the current context.
(Inherited from LoggingContext.) | |
IndentLevel |
Gets or sets the indentation level for the current context.
(Inherited from LoggingContext.) | |
IsAsync |
Determines whether the current LoggingContext represents an async method or an asynchronous custom activity.
(Overrides LoggingContext.IsAsync.) | |
IsDisposed |
Determines whether the current context has been disposed.
(Inherited from LoggingContext.) | |
IsHidden |
Determines whether the current LoggingContext is hidden. Hidden contexts may define properties but should not be rendered.
(Inherited from LoggingContext.) | |
IsSharable |
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.
(Inherited from LoggingContext.) | |
IsSuspended | (Inherited from SuspendableLoggingContext.) | |
Kind |
Gets the kind of the current context.
(Inherited from LoggingContext.) | |
MemberName |
Gets the name of the method or property related to the current context.
(Inherited from LoggingContext.) | |
ParentContext | Obsolete.
Gets the LoggingContext in which the current context was activated. Previously, this was the logical parent instead.
(Inherited from LoggingContext.) | |
Properties | Obsolete.
Gets the logging properties added with the associated activity.
(Inherited from LoggingContext.) | |
Source |
Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member
associated to the current context.
(Inherited from LoggingContext.) | |
SyntheticId |
Gets a cross-process globally unique identifier for the current LoggingContext.
This value is created according to value of the LoggingBackend.Options.SyntheticIdFormatter property.
(Inherited from LoggingContext.) | |
SyntheticParentId |
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.
(Inherited from LoggingContext.) | |
SyntheticRootId |
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.
(Inherited from LoggingContext.) | |
ThreadContext |
Gets the ThreadLoggingContext for the thread in which the current LoggingContext
is currently executed.
(Inherited from SuspendableLoggingContext.) |
Name | Description | |
---|---|---|
CreateCorrelationCookie |
Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context
to the current context.
(Inherited from LoggingContext.) | |
Dispose() | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.) | |
Dispose(Boolean) |
Disposes the current object.
(Inherited from SuspendableLoggingContext.) | |
ForEachProperty(LoggingPropertyVisitor<Object>, Boolean) | Obsolete.
Invokes a delegate for each property defined in the current logging context and optionally in its ancestor contexts.
(Inherited from LoggingContext.) | |
ForEachProperty<T>(LoggingPropertyVisitor<T>, T, Boolean) | Obsolete.
Invokes a delegate for each property defined in the current logging context and optionally in its ancestor contexts, and specifies passes a state object
to the delegate.
(Inherited from LoggingContext.) | |
GetCustomRecordBuilder |
Gets a LogRecordBuilder for the current context to build a custom record.
(Inherited from LoggingContext.) | |
GetExecutionContextData |
Returns a new layer for the async stack that has this LoggingContext as the associated activity and current as the
Parent, if a new layer is required.
(Overrides LoggingContext.GetExecutionContextData(LoggingExecutionContextData, Boolean).) | |
GetRecordBuilder |
Gets a LogRecordBuilder for the current context to build a standard record for a given method.
(Inherited from LoggingContext.) | |
MakeSharable |
Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool.
(Inherited from LoggingContext.) | |
Resume |
Resumes the current context. Typically called when the state machine resumes execution, when the wait dependency
is satisfied (in case of async methods) or when the MoveNext() method is called (in case of iterators).
(Inherited from SuspendableLoggingContext.) | |
ResumeConditional |
Resume the current context, but only if it is currently suspended.
(Inherited from SuspendableLoggingContext.) | |
SetCorrelation |
Associates the current context with another context.
(Inherited from LoggingContext.) | |
SetWaitDependency |
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.
(Inherited from LoggingContext.) | |
Suspend |
Suspends the current context. Typically called when starting to wait for a wait dependency (the operand of the await operator
in case of async methods), or after the MoveNext() method (in case of iterators).
(Inherited from SuspendableLoggingContext.) | |
ToString() | Returns a string that represents the current object. (Inherited from LoggingContext.) | |
ToString(StringBuilder) |
Formats a description of the current LoggingContext into a given StringBuilder.
(Inherited from SuspendableLoggingContext.) | |
VisitProperties(Action<String, Object>, Boolean) |
Invokes a delegate each property on the current context, and, optionally, for inherited properties in ancestor contexts.
This offers a simple way to visit properties, but it has a performance overhead compared to VisitProperties<TState>(ILoggingPropertyVisitor<TState>, TState, LoggingPropertyVisitorOptions)
because it is weakly typed and cause the allocation of a closure class to build the action. It also does not expose the LoggingPropertyOptions.
(Inherited from LoggingContext.) | |
VisitProperties<TState>(ILoggingPropertyVisitor<TState>, TState, LoggingPropertyVisitorOptions) |
Invokes the Visit<TValue>(String, TValue, LoggingPropertyOptions, TState) method
of an interface implementation for each property on the current context, and, optionally, for inherited properties in ancestor contexts.
(Inherited from LoggingContext.) |