Partilhar via


IRelationalConnectionDiagnosticsLogger Interface

Definition

An IDiagnosticsLogger<TLoggerCategory> with some extra functionality suited for high-performance logging.

public interface IRelationalConnectionDiagnosticsLogger : Microsoft.EntityFrameworkCore.Diagnostics.IDiagnosticsLogger<Microsoft.EntityFrameworkCore.DbLoggerCategory.Database.Connection>
type IRelationalConnectionDiagnosticsLogger = interface
    interface IDiagnosticsLogger<DbLoggerCategory.Database.Connection>
    interface IDiagnosticsLogger
Public Interface IRelationalConnectionDiagnosticsLogger
Implements IDiagnosticsLogger(Of DbLoggerCategory.Database.Connection)
Implements

Remarks

The service lifetime is Scoped. This means that each DbContext instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

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

Properties

DbContextLogger

The IDbContextLogger.

(Inherited from IDiagnosticsLogger)
Definitions

Caching for logging definitions.

(Inherited from IDiagnosticsLogger)
DiagnosticSource

The DiagnosticSource.

(Inherited from IDiagnosticsLogger<TLoggerCategory>)
Interceptors

Holds registered interceptors, if any.

(Inherited from IDiagnosticsLogger<TLoggerCategory>)
Logger

The underlying ILogger.

(Inherited from IDiagnosticsLogger<TLoggerCategory>)
Options

Entity Framework logging options.

(Inherited from IDiagnosticsLogger<TLoggerCategory>)

Methods

ConnectionClosed(IRelationalConnection, DateTimeOffset, TimeSpan)

Logs for the ConnectionClosed event.

ConnectionClosedAsync(IRelationalConnection, DateTimeOffset, TimeSpan)

Logs for the ConnectionClosed event.

ConnectionClosing(IRelationalConnection, DateTimeOffset)

Logs for the ConnectionClosing event.

ConnectionClosingAsync(IRelationalConnection, DateTimeOffset)

Logs for the ConnectionClosing event.

ConnectionCreated(IRelationalConnection, DateTimeOffset, TimeSpan)

Logs for the ConnectionCreated event.

ConnectionCreating(IRelationalConnection, DateTimeOffset)

Logs for the ConnectionCreating event.

ConnectionDisposed(IRelationalConnection, DateTimeOffset, TimeSpan)

Logs for the ConnectionDisposed event.

ConnectionDisposedAsync(IRelationalConnection, DateTimeOffset, TimeSpan)

Logs for the ConnectionDisposed event.

ConnectionDisposing(IRelationalConnection, DateTimeOffset)

Logs for the ConnectionDisposing event.

ConnectionDisposingAsync(IRelationalConnection, DateTimeOffset)

Logs for the ConnectionDisposing event.

ConnectionError(IRelationalConnection, Exception, DateTimeOffset, TimeSpan, Boolean)

Logs for the ConnectionError event.

ConnectionErrorAsync(IRelationalConnection, Exception, DateTimeOffset, TimeSpan, Boolean, CancellationToken)

Logs for the ConnectionError event.

ConnectionOpened(IRelationalConnection, DateTimeOffset, TimeSpan)

Logs for the ConnectionOpened event.

ConnectionOpenedAsync(IRelationalConnection, DateTimeOffset, TimeSpan, CancellationToken)

Logs for the ConnectionOpened event.

ConnectionOpening(IRelationalConnection, DateTimeOffset)

Logs for the ConnectionOpening event.

ConnectionOpeningAsync(IRelationalConnection, DateTimeOffset, CancellationToken)

Logs for the ConnectionOpening event.

DispatchEventData(EventDefinitionBase, EventData, Boolean, Boolean)

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

(Inherited from IDiagnosticsLogger)
GetLogBehavior(EventId, LogLevel)

Checks if the given logLevel is enabled or the given event, and, if so, whether the event should be logged or thrown.

(Inherited from IDiagnosticsLogger<TLoggerCategory>)
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.

(Inherited from IDiagnosticsLogger)
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.

(Inherited from IDiagnosticsLogger)
ShouldLog(EventDefinitionBase)

Checks whether the message should be sent to the ILogger.

(Inherited from IDiagnosticsLogger)
ShouldLogConnectionClose(DateTimeOffset)

Whether ConnectionClosing or ConnectionClosed need to be logged.

ShouldLogConnectionCreate(DateTimeOffset)

Whether ConnectionCreating or ConnectionCreated need to be logged.

ShouldLogConnectionDispose(DateTimeOffset)

Whether ConnectionDisposing or ConnectionDisposed need to be logged.

ShouldLogConnectionOpen(DateTimeOffset)

Whether ConnectionOpening or ConnectionOpened need to be logged.

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.

(Inherited from IDiagnosticsLogger<TLoggerCategory>)

Extension Methods

SensitiveDataLoggingEnabledWarning<TLoggerCategory>(IDiagnosticsLogger<TLoggerCategory>)

Logs for the SensitiveDataLoggingEnabledWarning event.

Applies to