Share via


IDiagnosticsLogger 接口

定义

ILogger合并 和 DiagnosticSource 供所有 EF Core 日志记录使用,以便可以将事件发送到 ILogger ASP.NET 和其他DiagnosticSource所有内容。

public interface IDiagnosticsLogger
type IDiagnosticsLogger = interface
Public Interface IDiagnosticsLogger
派生

注解

服务生存期为 Singleton。 这意味着多个实例使用 DbContext 单个实例。 实现必须是线程安全的。 此服务不能依赖于注册为 的服务 Scoped

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

属性

DbContextLogger

IDbContextLogger

Definitions

日志记录定义的缓存。

DiagnosticSource

DiagnosticSource

Interceptors

保留已注册的侦听器(如果有)。

Logger

基础 ILogger

Options

实体框架日志记录选项。

方法

DispatchEventData(EventDefinitionBase, EventData, Boolean, Boolean)

将给定 EventData 的 调度到 DiagnosticSource(如果已启用)和 IDbContextLogger(如果已启用)。

NeedsEventData(EventDefinitionBase, Boolean, Boolean)

EventData根据给定事件是否DiagnosticSource启用了 或 IDbContextLogger ,确定是否需要 实例。

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

EventData根据给定事件是否DiagnosticSource启用了 、 IDbContextLoggerIInterceptor ,确定是否需要实例。

ShouldLog(EventDefinitionBase)

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

ShouldLogSensitiveData()

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

适用于