Interface IDbContextLogger
- Namespace
- Microsoft.EntityFrameworkCore.Diagnostics
- Assembly
- Microsoft.EntityFrameworkCore.dll
A simple logging interface for Entity Framework events. Used by LogTo(Action<string>, LogLevel, DbContextLoggerOptions?)
public interface IDbContextLogger
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 EF Core simple logging for more information and examples.
Methods
Log(EventData)
Logs the given EventData.
void Log(EventData eventData)
Parameters
eventData
EventDataThe event to log.
Remarks
This method is only called if ShouldLog(EventId, LogLevel) returns true.
The specific subtype of the EventData argument is dependent on the event being logged. See CoreEventId for the type of event data used for each core event.
ShouldLog(EventId, LogLevel)
Determines whether or not the given event should be logged.
bool ShouldLog(EventId eventId, LogLevel logLevel)