Open sandboxFocus

Class LoggingContextLocalConfiguration

Stores the context-sensitive configuration, that is, the configuration that is specific to the current execution context.

Inheritance
LoggingContextLocalConfiguration
Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics.dll
Syntax
public class LoggingContextLocalConfiguration
Remarks

User code can switch from one LoggingContextLocalConfiguration to another for the current context using the WithContextLocalConfiguration(LoggingContextLocalConfiguration) method. The current instance is exposed by the CurrentContextLocalConfiguration property. The default instance is exposed by the DefaultContextLocalConfiguration property.

Unlike LoggingVerbosityConfiguration, this class is lightweight and can be allocated at high frequency. However, it is recommended that only a few instances of the LoggingVerbosityConfiguration class are created.

Constructors

Name Description
LoggingContextLocalConfiguration(LoggingVerbosityConfiguration)

Initializes a new instance of the LoggingContextLocalConfiguration class.

Properties

Name Description
IsEnabled

Gets or sets a value indicating whether logging is enabled for all contexts that use this configuration. This is typically used to disable logging for the current transaction. If logging is disabled, the default configuration is used.

IsReadOnly

Gets a value indicating whether the current LoggingContextLocalConfiguration is read-only. A LoggingContextLocalConfiguration is frozen when it is assigned to a caching backend.

Verbosity

Gets the configuration of the minimum LogLevel that is still logged for the current LoggingContextLocalConfiguration.

Methods

Name Description
Clone()

Returns a shallow copy of the current instance. The copy shares the same value of the Verbosity property.

Freeze()

Prevents changes in the current instance. This method is called when the LoggingContextLocalConfiguration is passed to the WithContextLocalConfiguration(LoggingContextLocalConfiguration) method.