-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #16200 Fixes #1199 Examples: Log to the Console: ```C# protected override void OnConfiguring(DbContextOptionsBuilder options) => options .UseMyProvider("...") .LogTo(Console.WriteLine); ``` Log to the Console for a given level: ```C# protected override void OnConfiguring(DbContextOptionsBuilder options) => options .UseMyProvider("...") .LogTo(Console.WriteLine, LogLevel.Information)); ``` Log to the Console for specific events: ```C# protected override void OnConfiguring(DbContextOptionsBuilder options) => options .UseMyProvider("...") .LogTo(Console.WriteLine, new[] { CoreEventId.ContextInitialized, CoreEventId.ContextDisposed })); ``` Log to the Console for specific categories: ```C# protected override void OnConfiguring(DbContextOptionsBuilder options) => options .UseMyProvider("...") .LogTo(Console.WriteLine, new[] { DbLoggerCategory.Infrastructure.Name, DbLoggerCategory.Update.Name })); ``` Log to the Console with custom filter: ```C# protected override void OnConfiguring(DbContextOptionsBuilder options) => options .UseMyProvider("...") .LogTo(Console.WriteLine, (e, l) => e == CoreEventId.SaveChangesCompleted))); ``` Log to the Console for events in specific categories and a given level formatted as a single line using UTC timestamps: ```C# protected override void OnConfiguring(DbContextOptionsBuilder options) => options .UseMyProvider("...") .LogTo( Console.WriteLine, new[] { DbLoggerCategory.Infrastructure.Name, DbLoggerCategory.Update.Name }, LogLevel.Information, SimpleLoggerFormatOptions.SingleLine | SimpleLoggerFormatOptions.DefaultWithUtcTime | )); ```
- Loading branch information
1 parent
7a71eb0
commit c5a8c1c
Showing
69 changed files
with
2,586 additions
and
1,741 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.