Table of Contents

Interface IDiagnosticsLogger<TLoggerCategory>

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

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<TLoggerCategory> : IDiagnosticsLogger where TLoggerCategory : LoggerCategory<TLoggerCategory>, new()

Type Parameters

TLoggerCategory
Inherited Members
Extension Methods

Remarks

Also intercepts messages such that warnings can be either logged or thrown, and such that a decision as to whether to log sensitive data or not can be made.

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.