Add logging to Entity Framework Core workload.

This commit is contained in:
Kevin Matsubara 2025-04-04 20:12:03 +02:00
parent 6e0167a051
commit 25ede5cc28

View File

@ -1,6 +1,7 @@
using Microsoft.EntityFrameworkCore;
using EntityFrameworkCore.Domain;
using Microsoft.Extensions.Logging;
namespace EntityFrameworkCore.Data;
@ -19,7 +20,10 @@ public class DeadBallZoneLeagueDbContext : DbContext
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlite($"Data source={DbPath}");
optionsBuilder.UseSqlite($"Data source={DbPath}")
.LogTo(Console.WriteLine, LogLevel.Information)
.EnableSensitiveDataLogging() // Do not allow this in Production.
.EnableDetailedErrors(); // Do not allow this in Production.
}
protected override void OnModelCreating(ModelBuilder modelBuilder)