Open sandboxFocus
  • TOC

Post­Sharp Documentation

Introduction

Deployment and Configuration

Adding Aspects to Code

Logging

Contracts

INotify­Property­Changed

Weak Event

XAML

Parent/Child, Visitor and Disposable

Undo/Redo

Caching

Multithreading

Developing Custom Aspects

Validating Architecture

Testing and Debugging

Miscellaneous

API Reference

Post­Sharp

Post­Sharp.​Aspects

Post­Sharp.​Aspects.​Advices

Post­Sharp.​Aspects.​Configuration

Post­Sharp.​Aspects.​Dependencies

Post­Sharp.​Aspects.​Internals

Post­Sharp.​Aspects.​Serialization

Post­Sharp.​Collections

Post­Sharp.​Constraints

Post­Sharp.​Extensibility

Post­Sharp.​Extensibility.​Build­Time­Logging

Post­Sharp.​Patterns

Post­Sharp.​Patterns.​Caching

Post­Sharp.​Patterns.​Caching.​Backends

Post­Sharp.​Patterns.​Caching.​Backends.​Azure

Post­Sharp.​Patterns.​Caching.​Backends.​Redis

Post­Sharp.​Patterns.​Caching.​Dependencies

Post­Sharp.​Patterns.​Caching.​Formatters

Post­Sharp.​Patterns.​Caching.​Implementation

Post­Sharp.​Patterns.​Caching.​Locking

Post­Sharp.​Patterns.​Caching.​Serializers

Post­Sharp.​Patterns.​Caching.​Value­Adapters

Post­Sharp.​Patterns.​Collections

Post­Sharp.​Patterns.​Collections.​Advices

Post­Sharp.​Patterns.​Contracts

Post­Sharp.​Patterns.​Diagnostics

Close­Activity­Options

Context­Id­Generation­Strategy

Custom­Record­Logging­Options

Default­Logging­Exception­Handler

Formatted­Message­Builder

ILog­Activity

ILog­Aspect

ILogging­Exception­Handler

ILog­Value­Aspect

Log­Activity2

Log­Activity<TActivity­Description>

Log­Activity­Kind

Log­Activity­Options

Log­Attribute6

Log­Attribute­Base5

Log­Exception­Attribute6

Logger

Logger­Factory­Extensions

Logging­Abstract­Source

Logging­Backend

Logging­Backend­Options

Logging­Build­Time­Configuration

Logging­Configuration­Manager

Logging­Context­Local­Configuration

Logging­Context­Local­Configuration­Scope

Logging­Context­Mismatch­Exception2

Logging­Exception2

Logging­Exception­Info

Logging­Namespace­Source

Logging­Options

Logging­Options.​Serializer2

Logging­Profile

Logging­Profile.​Serializer2

Logging­Profile­Collection3

Logging­Profile­Repository

Logging­Property

Logging­Role­Configuration

Logging­Role­Configuration­Repository

Logging­Roles

Logging­Services

Logging­Services.​Formatters2

Logging­Source­Local­State

Logging­Type­Source2

Logging­Verbosity­Configuration

Log­Level

Log­Record­Kind

Log­Record­Kind­Extensions

Log­Source

Log­Value­Attribute5

Not­Logged­Attribute2

Open­Activity­Options

Semantic­Message­Builder

Throwing­Logging­Exception­Handler

Write­Message­Options

Post­Sharp.​Patterns.​Diagnostics.​Adapters.​Asp­Net­Core

Post­Sharp.​Patterns.​Diagnostics.​Adapters.​Asp­Net­Framework

Post­Sharp.​Patterns.​Diagnostics.​Adapters.​Diagnostic­Source

Post­Sharp.​Patterns.​Diagnostics.​Adapters.​Http­Client

Post­Sharp.​Patterns.​Diagnostics.​Audit

Post­Sharp.​Patterns.​Diagnostics.​Backends

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Application­Insights

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Audit

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Common­Logging

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Console

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Event­Source

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Log4Net

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Microsoft

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Multiplexer

Post­Sharp.​Patterns.​Diagnostics.​Backends.​NLog

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Null

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Serilog

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Trace

Post­Sharp.​Patterns.​Diagnostics.​Backends.​Trace­Source

Post­Sharp.​Patterns.​Diagnostics.​Contexts

Post­Sharp.​Patterns.​Diagnostics.​Correlation

Post­Sharp.​Patterns.​Diagnostics.​Custom

Post­Sharp.​Patterns.​Diagnostics.​Custom.​Messages

Post­Sharp.​Patterns.​Diagnostics.​Formatters

Post­Sharp.​Patterns.​Diagnostics.​Record­Builders

Post­Sharp.​Patterns.​Diagnostics.​Threading­Instrumentation

Post­Sharp.​Patterns.​Diagnostics.​Transactions

Post­Sharp.​Patterns.​Diagnostics.​Transactions.​Model

Post­Sharp.​Patterns.​Dynamic­Advising

Post­Sharp.​Patterns.​Formatters

Post­Sharp.​Patterns.​Model

Post­Sharp.​Patterns.​Model.​Controls

Post­Sharp.​Patterns.​Model.​Type­Adapters

Post­Sharp.​Patterns.​Recording

Post­Sharp.​Patterns.​Recording.​Operations

Post­Sharp.​Patterns.​Threading

Post­Sharp.​Patterns.​Threading.​Models

Post­Sharp.​Patterns.​Utilities

Post­Sharp.​Patterns.​Xaml

Post­Sharp.​Reflection

Post­Sharp.​Reflection.​Method­Body

Post­Sharp.​Serialization

  • Article

Class LoggingBackend

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

Implements
Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics.dll
Syntax
public abstract class LoggingBackend : IDisposable
Remarks

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

Constructors

Name Description
LoggingBackend()

Initializes a new LoggingBackend.

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 the WithContextLocalConfiguration(LoggingContextLocalConfiguration) for the current execution context.

DefaultVerbosity

Gets the LoggingVerbosityConfiguration of the DefaultContextLocalConfiguration.

IsCorrupted

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.

IsDisposed

Determines whether the current LoggingBackend has been disposed.

IsEnabled

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.

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.

Methods

Name Description
CreateAsyncCustomActivityContext()

Creates a new AsyncCustomActivityLoggingContext.

CreateAsyncMethodContext()

Creates a new AsyncMethodLoggingContext for a given async method.

CreateContextLocalConfiguration(LoggingVerbosityConfiguration)

Creates a new LoggingContextLocalConfiguration.

CreateEphemeralContext(ThreadLoggingContext)

Creates a new EphemeralLoggingContext.

CreateExecutionContextData()

Creates a new empty instance of PostSharp.Patterns.Diagnostics.LoggingBackend.ExecutionContextData possibly of a subclass which can hold backend-specific data.

CreateIteratorContext()

Creates a new IteratorLoggingContext for a given iterator method.

CreateRecordBuilder()

Creates a new LogRecordBuilder.

CreateSyncCustomActivityContext(ThreadLoggingContext)

Creates a new SyncCustomActivityLoggingContext.

CreateSyncMethodContext(ThreadLoggingContext)

Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method.

CreateThreadContext()

Creates a new ThreadLoggingContext.

CreateTransaction(LoggingTypeSource, in TransactionProperties, ITransactionPolicy)

Creates a LoggingTransaction instance.

CreateTypeSource(LoggingNamespaceSource, Type)

Creates a LoggingTypeSource for the given role and type.

CreateTypeSourceBySourceName(LoggingNamespaceSource, string)

Creates a LoggingTypeSource for the given role and logger name.

CreateVerbosityConfiguration()

Creates a new LoggingVerbosityConfiguration for the current LoggingBackend.

Dispose()
Dispose(bool)

Disposes the current object.

GetAsyncContextOfTask(Task)

Gets the AsyncMethodLoggingContext associated with a Task.

GetBackendOptions()

Gets the formatting and rendering options for the current LoggingBackend.

GetSource(string, string)

Returns a LoggingNamespaceSource for the given role and, optionally, namespace.

GetSource(string, Type)

Returns a LoggingTypeSource for the given role and type.

GetThreadContext()

Returns the ThreadLoggingContext for the current Thread.

OpenAsyncContext(AsyncCallId, ref LogMemberInfo)

Gets an AsyncMethodLoggingContext for a given async method.

OpenEphemeralContext(ref LogMemberInfo)

Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record.

OpenEphemeralContext(LoggingTypeSource, ref ThreadLoggingContext)

Gets an EphemeralLoggingContext for use in a given LoggingTypeSource. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record.

OpenIteratorContext(IEnumerator, ref LogMemberInfo)

Gets an IteratorLoggingContext for a given iterator method.

OpenSyncContext(ref LogMemberInfo)

Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method.

ToString()
WithContextLocalConfiguration(LoggingContextLocalConfiguration)

Changes the LoggingContextLocalConfiguration for the current execution context.

WithVerbosityConfiguration(LoggingVerbosityConfiguration)

Changes the verbosity for the current execution context.

  • Navigation