PostSharp 6.9 / / Post­Sharp Documentation / API Reference / Post­Sharp.​Patterns.​Diagnostics Namespace / Logging­Backend Class

LoggingBackend Class

Base class for all logging back-ends (sometimes names sinks, targets, listeners) of the PostSharp logging system.
Inheritance Hierarchy

Namespace:  PostSharp.Patterns.Diagnostics
Assembly:  PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.9.11.0 (6.9.11.0)
Syntax
C#
public abstract class LoggingBackend : IDisposable

The LoggingBackend type exposes the following members.

Constructors
  NameDescription
Protected methodLoggingBackend
Initializes a new LoggingBackend.
Properties
  NameDescription
Public propertyCurrentContext
Gets the current LoggingContext.
Public propertyCurrentContextLocalConfiguration
Gets the LoggingContextLocalConfiguration for the current execution. Returns DefaultContextLocalConfiguration unless the context has been overwritten by WithContextLocalConfiguration(LoggingContextLocalConfiguration).
Public propertyDefaultContextLocalConfiguration
Gets the default LoggingContextLocalConfiguration, used unless it has been overwritten by the WithContextLocalConfiguration(LoggingContextLocalConfiguration) for the current execution context.
Public propertyDefaultVerbosity
Public propertyIsCorrupted
Determines 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.
Public propertyIsDisposed
Determines whether the current LoggingBackend has been disposed.
Public propertyIsEnabled
Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method.
Public propertyOptions
Gets the formatting and rendering options for the current LoggingBackend.
Public propertyTransactionPolicySelector
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.
Methods
  NameDescription
Protected methodCreateAsyncCustomActivityContext
Protected methodCreateAsyncMethodContext
Creates a new AsyncMethodLoggingContext for a given async method.
Protected methodCreateContextLocalConfiguration
Protected methodCreateEphemeralContext
Creates a new EphemeralLoggingContext.
Protected methodCreateExecutionContextData
Creates a new empty instance of ExecutionContextData possibly of a subclass which can hold backend-specific data.
Protected methodCreateIteratorContext
Creates a new IteratorLoggingContext for a given iterator method.
Public methodCreateRecordBuilder
Creates a new LogRecordBuilder.
Protected methodCreateSyncCustomActivityContext
Protected methodCreateSyncMethodContext
Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method.
Protected methodCreateThreadContext
Creates a new ThreadLoggingContext.
Public methodCreateTransaction
Creates a LoggingTransaction instance.
Protected methodCreateTypeSource
Creates a LoggingTypeSource for the given role and type.
Protected methodCreateTypeSourceBySourceName
Creates a LoggingTypeSource for the given role and logger name.
Public methodCreateVerbosityConfiguration
Creates a new LoggingVerbosityConfiguration for the current LoggingBackend.
Public methodDispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Protected methodDispose(Boolean)
Disposes the current object.
Public methodGetAsyncContextOfTask
Gets the AsyncMethodLoggingContext associated with a Task.
Protected methodGetBackendOptions
Gets the formatting and rendering options for the current LoggingBackend.
Public methodGetSource(String, String) Obsolete.
Returns a LoggingNamespaceSource for the given role and, optionally, namespace.
Public methodGetSource(String, Type) Obsolete.
Returns a LoggingTypeSource for the given role and type.
Public methodGetThreadContext
Returns the ThreadLoggingContext for the current Thread.
Public methodOpenAsyncContext
Gets an AsyncMethodLoggingContext for a given async method.
Public methodOpenEphemeralContext(LogMemberInfo)
Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record.
Public methodOpenEphemeralContext(LoggingTypeSource, ThreadLoggingContext)
Gets an EphemeralLoggingContext for use in a given LoggingTypeSource. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record.
Public methodOpenIteratorContext
Gets an IteratorLoggingContext for a given iterator method.
Public methodOpenSyncContext
Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method.
Public methodToString
Returns a string that represents the current object.
(Overrides Object.ToString().)
Protected methodWithContextLocalConfiguration
Changes the LoggingContextLocalConfiguration for the current execution context.
Public methodWithVerbosityConfiguration
Changes the verbosity for the current execution context.
Extension Methods
  NameDescription
Public Extension MethodConfigureFromXml(XDocument, Boolean)Overloaded.
Configures a LoggingBackend from an XDocument.
(Defined by LoggingConfigurationManager.)
Public Extension MethodConfigureFromXml(XElement, Boolean)Overloaded.
Configures a LoggingBackend from an XElement.
(Defined by LoggingConfigurationManager.)
Public Extension MethodConfigureFromXmlAsync
Configures a LoggingBackend from an XML configuration file whose location is specified in a Uri.
(Defined by LoggingConfigurationManager.)
Public Extension MethodConfigureFromXmlWithAutoReloadAsync
Configures a LoggingBackend from an XML configuration file whose location is specified in a Uri and specifies a TimeSpan at which the file should be refreshed from source.
(Defined by LoggingConfigurationManager.)
Public Extension MethodResetConfiguration
Removes the TransactionPolicySelector and resets the DefaultVerbosity of a given LoggingBackend.
(Defined by LoggingConfigurationManager.)
Public Extension MethodStopAutoReloadConfigurationAsync
Stops all auto-refresh configuration set up by ConfigureFromXmlWithAutoReloadAsync(LoggingBackend, Uri, TimeSpan, CancellationToken) and waits until all pending operations have completed.
(Defined by LoggingConfigurationManager.)
Remarks

If you want to implement your own logging back-end, deriving from the TextLoggingBackend class, which implements standard logic for logging a text.

See Also