PostSharpAPI ReferencePost­Sharp.​Patterns.​Diagnostics.​ContextsThread­Logging­Context
Open sandboxFocus

ThreadLoggingContext Class

A LoggingContext that represents the current thread. The ThreadLoggingContext has two usages. First, it is used to store all thread-local variables and objects. Then, it is used as the root object for all other contexts.

Inheritance
ThreadLoggingContext
Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics.dll
Syntax
public class ThreadLoggingContext : LoggingContext, ILoggingContext

Constructors

Name Description
ThreadLoggingContext(LoggingBackend, LogRecordBuilder)

Initializes a new ThreadLoggingContext.

Properties

Name Description
IsAsync

Determines whether the current LoggingContext represents an async method or an asynchronous custom activity.

IsLogging

Determines whether the current thread is emitting a log record. This allows to avoid infinite recursion while logging.

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.

ThreadContext

Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed.

Methods

Name Description
Dispose(Boolean)

Disposes the current object.

GetCustomRecordBuilder(LoggingContext, ref CustomLogRecordInfo)

Gets a LogRecordBuilder and initializes it to emit a custom record.

GetRecordBuilder(LoggingContext, ref LogRecordInfo, ref LogMemberInfo)

Gets a LogRecordBuilder and initializes it for a given context, member, and record.

ToString(StringBuilder)

Formats a description of the current LoggingContext into a given StringBuilder.