Table of Contents

Class DiagnosticsLogger<TLoggerCategory>

Namespace
Microsoft.EntityFrameworkCore.Diagnostics.Internal
Assembly
Microsoft.EntityFrameworkCore.dll

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

public class DiagnosticsLogger<TLoggerCategory> : IDiagnosticsLogger<TLoggerCategory>, IDiagnosticsLogger where TLoggerCategory : LoggerCategory<TLoggerCategory>, new()

Type Parameters

TLoggerCategory
Inheritance
DiagnosticsLogger<TLoggerCategory>
Implements
IDiagnosticsLogger<TLoggerCategory>
Inherited Members
Extension Methods

Constructors

DiagnosticsLogger(ILoggerFactory, ILoggingOptions, DiagnosticSource, LoggingDefinitions, IDbContextLogger, IInterceptors?)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

public DiagnosticsLogger(ILoggerFactory loggerFactory, ILoggingOptions loggingOptions, DiagnosticSource diagnosticSource, LoggingDefinitions loggingDefinitions, IDbContextLogger contextLogger, IInterceptors? interceptors = null)

Parameters

loggerFactory ILoggerFactory
loggingOptions ILoggingOptions
diagnosticSource DiagnosticSource
loggingDefinitions LoggingDefinitions
contextLogger IDbContextLogger
interceptors IInterceptors

Properties

DbContextLogger

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

public virtual IDbContextLogger DbContextLogger { get; }

Property Value

IDbContextLogger

Definitions

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

public virtual LoggingDefinitions Definitions { get; }

Property Value

LoggingDefinitions

DiagnosticSource

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

public virtual DiagnosticSource DiagnosticSource { get; }

Property Value

DiagnosticSource

Interceptors

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

public virtual IInterceptors? Interceptors { get; }

Property Value

IInterceptors

Logger

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

public virtual ILogger Logger { get; }

Property Value

ILogger

Options

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

public virtual ILoggingOptions Options { get; }

Property Value

ILoggingOptions

Methods

DispatchEventData(EventDefinitionBase, EventData, bool, bool)

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

protected void DispatchEventData(EventDefinitionBase definition, EventData eventData, bool diagnosticSourceEnabled, bool simpleLogEnabled)

Parameters

definition EventDefinitionBase

The definition of the event to log.

eventData EventData

The event data.

diagnosticSourceEnabled bool

True to dispatch to a DiagnosticSource; false otherwise.

simpleLogEnabled bool

True to dispatch to a IDbContextLogger; false otherwise.

NeedsEventData<TInterceptor>(EventDefinitionBase, out TInterceptor?, out bool, out bool)

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

protected bool NeedsEventData<TInterceptor>(EventDefinitionBase definition, out TInterceptor? interceptor, out bool diagnosticSourceEnabled, out bool simpleLogEnabled) where TInterceptor : class, IInterceptor

Parameters

definition EventDefinitionBase

The definition of the event.

interceptor TInterceptor

The IInterceptor to use if enabled; otherwise null.

diagnosticSourceEnabled bool

Set to true if a DiagnosticSource is enabled; false otherwise.

simpleLogEnabled bool

True to true if a IDbContextLogger is enabled; false otherwise.

Returns

bool

true if either a diagnostic source, a LogTo logger, or an interceptor is enabled; false otherwise.

Type Parameters

TInterceptor

ShouldLog(EventDefinitionBase)

Checks whether or not the message should be sent to the ILogger.

protected bool ShouldLog(EventDefinitionBase definition)

Parameters

definition EventDefinitionBase

The definition of the event to log.

Returns

bool

true if ILogger logging is enabled and the event should not be ignored; false otherwise.

ShouldLogSensitiveData()

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

public virtual bool ShouldLogSensitiveData()

Returns

bool