Debug query logging

This commit is contained in:
Noi 2022-03-20 22:33:16 -07:00
parent 4e0f23c033
commit a88797cb0a

View file

@ -24,6 +24,9 @@ public class BotDatabaseContext : DbContext {
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
=> optionsBuilder => optionsBuilder
.UseNpgsql(NpgsqlConnectionString) .UseNpgsql(NpgsqlConnectionString)
#if DEBUG
.LogTo((string line) => Program.Log("EF", line), Microsoft.Extensions.Logging.LogLevel.Information)
#endif
.UseSnakeCaseNamingConvention(); .UseSnakeCaseNamingConvention();
protected override void OnModelCreating(ModelBuilder modelBuilder) { protected override void OnModelCreating(ModelBuilder modelBuilder) {