-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simple Logging API for all logs #16200
Labels
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
type-enhancement
Milestone
Comments
ajcvickers
added a commit
that referenced
this issue
Nov 15, 2019
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 | )); ```
ajcvickers
added a commit
that referenced
this issue
Nov 23, 2019
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 | )); ```
ajcvickers
added a commit
that referenced
this issue
Nov 25, 2019
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 | )); ```
ajcvickers
added a commit
that referenced
this issue
Nov 25, 2019
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 | )); ```
ajcvickers
added a commit
that referenced
this issue
Nov 25, 2019
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 | )); ```
ajcvickers
added a commit
that referenced
this issue
Nov 26, 2019
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 | )); ```
ajcvickers
added
the
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
label
Dec 14, 2019
roji
added a commit
to roji/efcore.pg
that referenced
this issue
Jan 25, 2020
See dotnet/efcore#16200 Follows 690ebc4540334c1d0938660a5960a25d4338acd4 in EF Core
roji
added a commit
to roji/efcore.pg
that referenced
this issue
Jan 25, 2020
See dotnet/efcore#16200 Follows 690ebc4540334c1d0938660a5960a25d4338acd4 in EF Core
roji
added a commit
to roji/efcore.pg
that referenced
this issue
Jan 28, 2020
See dotnet/efcore#16200 Follows 690ebc4540334c1d0938660a5960a25d4338acd4 in EF Core
roji
added a commit
to roji/efcore.pg
that referenced
this issue
Jan 28, 2020
See dotnet/efcore#16200 Follows 690ebc4540334c1d0938660a5960a25d4338acd4 in EF Core
roji
added a commit
to roji/efcore.pg
that referenced
this issue
Jan 28, 2020
See dotnet/efcore#16200 Follows 690ebc4540334c1d0938660a5960a25d4338acd4 in EF Core
roji
added a commit
to roji/efcore.pg
that referenced
this issue
Jan 28, 2020
See dotnet/efcore#16200 Follows 690ebc4540334c1d0938660a5960a25d4338acd4 in EF Core
roji
added a commit
to roji/efcore.pg
that referenced
this issue
Jan 29, 2020
See dotnet/efcore#16200 Follows 690ebc4540334c1d0938660a5960a25d4338acd4 in EF Core
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
type-enhancement
Like
context.Database.Log
from #1199, but not just for database interactions.The text was updated successfully, but these errors were encountered: