Udostępnij za pośrednictwem


IDiagnosticsLogger Interface

Definition

Combines ILogger and DiagnosticSource for use by all EF Core logging so that events can be sent to both ILogger for ASP.NET and DiagnosticSource for everything else.

public interface IDiagnosticsLogger
type IDiagnosticsLogger = interface
Public Interface IDiagnosticsLogger
Derived

Remarks

The service lifetime is Singleton. This means a single instance is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.

See Implementation of database providers and extensions for more information and examples.

Properties

DbContextLogger

The IDbContextLogger.

Definitions

Caching for logging definitions.

DiagnosticSource

The DiagnosticSource.

Interceptors

Holds registered interceptors, if any.

Logger

The underlying ILogger.

Options

Entity Framework logging options.

Methods

DispatchEventData(EventDefinitionBase, EventData, Boolean, Boolean)

Dispatches the given EventData to a DiagnosticSource, if enabled, and a IDbContextLogger, if enabled.

NeedsEventData(EventDefinitionBase, Boolean, Boolean)

Determines whether an EventData instance is needed based on whether or not there is a DiagnosticSource or an IDbContextLogger enabled for the given event.

NeedsEventData<TInterceptor>(EventDefinitionBase, TInterceptor, Boolean, Boolean)

Determines whether an EventData instance is needed based on whether or not there is a DiagnosticSource, an IDbContextLogger, or an IInterceptor enabled for the given event.

ShouldLog(EventDefinitionBase)

Checks whether the message should be sent to the ILogger.

ShouldLogSensitiveData()

Gets a value indicating whether sensitive information should be written to the underlying logger. This also has the side effect of writing a warning to the log the first time sensitive data is logged.

Applies to