语言

IRelationalConnectionDiagnosticsLogger 接口

定义

具有 IDiagnosticsLogger<TLoggerCategory> 一些适用于高性能日志记录的额外功能。

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)
实现

注解

服务生存期为 Scoped。 这意味着每个 DbContext 实例都将使用此服务自己的实例。 实现可能依赖于注册到任何生存期的其他服务。 实现不需要线程安全。

有关详细信息和示例,请参阅 数据库提供程序和扩展的实现 。

属性

名称 说明
DbContextLogger

IDbContextLogger。

(继承自 IDiagnosticsLogger)
Definitions

日志记录定义的缓存。

(继承自 IDiagnosticsLogger)
DiagnosticSource

DiagnosticSource。

(继承自 IDiagnosticsLogger<TLoggerCategory>)
Interceptors

保留已注册的拦截器(如果有)。

(继承自 IDiagnosticsLogger<TLoggerCategory>)
Logger

基础 ILogger。

(继承自 IDiagnosticsLogger<TLoggerCategory>)
Options

Entity Framework 日志记录选项。

(继承自 IDiagnosticsLogger<TLoggerCategory>)

方法

名称 说明
ConnectionCanceled(IRelationalConnection, DateTimeOffset, TimeSpan)

事件的 ConnectionCanceled 日志。

ConnectionCanceledAsync(IRelationalConnection, DateTimeOffset, TimeSpan, CancellationToken)

事件的 ConnectionCanceled 日志。

ConnectionClosed(IRelationalConnection, DateTimeOffset, TimeSpan)

事件的 ConnectionClosed 日志。

ConnectionClosedAsync(IRelationalConnection, DateTimeOffset, TimeSpan)

事件的 ConnectionClosed 日志。

ConnectionClosing(IRelationalConnection, DateTimeOffset)

事件的 ConnectionClosing 日志。

ConnectionClosingAsync(IRelationalConnection, DateTimeOffset)

事件的 ConnectionClosing 日志。

ConnectionCreated(IRelationalConnection, DateTimeOffset, TimeSpan)

事件的 ConnectionCreated 日志。

ConnectionCreating(IRelationalConnection, DateTimeOffset)

事件的 ConnectionCreating 日志。

ConnectionDisposed(IRelationalConnection, DateTimeOffset, TimeSpan)

事件的 ConnectionDisposed 日志。

ConnectionDisposedAsync(IRelationalConnection, DateTimeOffset, TimeSpan)

事件的 ConnectionDisposed 日志。

ConnectionDisposing(IRelationalConnection, DateTimeOffset)

事件的 ConnectionDisposing 日志。

ConnectionDisposingAsync(IRelationalConnection, DateTimeOffset)

事件的 ConnectionDisposing 日志。

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

事件的 ConnectionError 日志。

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

事件的 ConnectionError 日志。

ConnectionOpened(IRelationalConnection, DateTimeOffset, TimeSpan)

事件的 ConnectionOpened 日志。

ConnectionOpenedAsync(IRelationalConnection, DateTimeOffset, TimeSpan, CancellationToken)

事件的 ConnectionOpened 日志。

ConnectionOpening(IRelationalConnection, DateTimeOffset)

事件的 ConnectionOpening 日志。

ConnectionOpeningAsync(IRelationalConnection, DateTimeOffset, CancellationToken)

事件的 ConnectionOpening 日志。

DispatchEventData(EventDefinitionBase, EventData, Boolean, Boolean)

将给定 EventData 项调度到 DiagnosticSource已启用的 、如果已启用,则调度一个 IDbContextLogger(如果已启用)。

(继承自 IDiagnosticsLogger)
GetLogBehavior(EventId, LogLevel)

检查给定 logLevel 是否已启用或给定事件,如果是,是否应记录或引发该事件。

(继承自 IDiagnosticsLogger<TLoggerCategory>)
NeedsEventData(EventDefinitionBase, Boolean, Boolean)

EventData根据给定事件是否存在DiagnosticSourceIDbContextLogger或启用实例来确定是否需要实例。

(继承自 IDiagnosticsLogger)
NeedsEventData<TInterceptor>(EventDefinitionBase, TInterceptor, Boolean, Boolean)

EventData根据给定事件是否存在DiagnosticSource实例、IDbContextLogger实例还是IInterceptor启用实例来确定是否需要实例。

(继承自 IDiagnosticsLogger)
ShouldLog(EventDefinitionBase)

检查是否应将消息发送到 。ILogger

(继承自 IDiagnosticsLogger)
ShouldLogConnectionClose(DateTimeOffset)

是记录还是ConnectionClosingConnectionClosed需要记录。

ShouldLogConnectionCreate(DateTimeOffset)

是记录还是ConnectionCreatingConnectionCreated需要记录。

ShouldLogConnectionDispose(DateTimeOffset)

是记录还是ConnectionDisposingConnectionDisposed需要记录。

ShouldLogConnectionOpen(DateTimeOffset)

是记录还是ConnectionOpeningConnectionOpened需要记录。

ShouldLogSensitiveData()

获取一个值,该值指示是否应将敏感信息写入基础记录器。 这也会影响在首次记录敏感数据时向日志写入警告的副作用。

(继承自 IDiagnosticsLogger<TLoggerCategory>)

扩展方法

名称 说明
SensitiveDataLoggingEnabledWarning<TLoggerCategory>(IDiagnosticsLogger<TLoggerCategory>)

事件的 SensitiveDataLoggingEnabledWarning 日志。

适用于