Base class for all logging backends (sometimes called sinks, targets, or listeners) of the PostSharp logging system.
Implements
Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics.dll
Syntax
public abstract class LoggingBackend : IDisposableRemarks
To implement your own logging backend, derive from the TextLoggingBackend class, which implements the standard logic for logging text. A custom backend usually also derives a class from LoggingTypeSource, returned by CreateTypeSource(LoggingNamespaceSource, Type), a class from TextLogRecordBuilder, returned by CreateRecordBuilder(), and an options class from TextLoggingBackendOptions. Override the factory methods of the context classes only when the contexts must store more information.
To use a backend, assign an instance to DefaultBackend when the application starts. To write to several backends at the same time, use the MultiplexerBackend.
Constructors
| Name | Description |
|---|---|
| LoggingBackend() | Initializes a new instance of the LoggingBackend class. |
Properties
| Name | Description |
|---|---|
| CurrentContext | Gets the current LoggingContext. |
| CurrentContextLocalConfiguration | Gets the LoggingContextLocalConfiguration for the current execution. Returns DefaultContextLocalConfiguration unless the context has been overwritten by WithContextLocalConfiguration(LoggingContextLocalConfiguration). |
| DefaultContextLocalConfiguration | Gets the default LoggingContextLocalConfiguration, used unless it has been overwritten by WithContextLocalConfiguration(LoggingContextLocalConfiguration) for the current execution context. |
| DefaultVerbosity | Gets the LoggingVerbosityConfiguration of the DefaultContextLocalConfiguration. |
| IsCorrupted | Gets a value indicating whether the current LoggingBackend is in a state where it can no longer be recovered. This typically happens when an exception occurs while disabling or enabling. |
| IsDisposed | Gets a value indicating whether the current LoggingBackend has been disposed. |
| IsEnabled | Gets or sets a value indicating whether the current LoggingBackend is enabled. This property has precedence over, and does not affect, the minimum log levels set through the SetLevel(LogLevel) method. |
| Options | Gets the formatting and rendering options for the current LoggingBackend. |
| TransactionPolicySelector | Gets or sets the selector that determines what policy to apply for each transaction or whether the transaction should be logged as a transaction at all. |