public class xxxContext : DbContext
      public static readonly ILoggerFactory MyLoggerFactory
              = LoggerFactory.Create(builder =>
              {
                  builder
                      .AddFilter((category, level) =>
                          category == DbLoggerCategory.Database.Command.Name
                          && level == LogLevel.Information)
                     .AddDebug();
              });
   protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            optionsBuilder.UseLoggerFactory(MyLoggerFactory);
        }

  

posted on 2020-07-04 15:53  Aaron_Net  阅读(205)  评论(0编辑  收藏  举报