Skip to content
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

Update MvcCoreLoggerExtensions to use LoggerMessageAttribute #40439

Merged
merged 1 commit into from
Mar 1, 2022

Conversation

pranavkm
Copy link
Contributor

@pranavkm pranavkm commented Feb 27, 2022

MvcCoreLoggerExtensions includes the log messages for a whole slew of MVC types. Consequently
it re-uses event ids and is hard maintain. This PR simultaenously updates the type to use
LoggerMessageAttribute, while also attempts to move as many of the individual log statements to the
appropriate type.

This change unearthed incorrect reuse of event ids within the same type that has also been corrected by assigning
new ids.

Fixes #32087

@ghost ghost added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Feb 27, 2022
MvcCoreLoggerExtensions includes the log messages for a whole slew of MVC types. Consequently
it re-uses event ids and is hard maintain. This PR simultaenously updates the type to use
LoggerMessageAttribute, while also attempts to move as many of the individual log statements to the
appropriate type.

This change unearthed incorrect reuse of event ids within the same type that has also been corrected by assigning
new ids.

Fixes dotnet#32087
@pranavkm pranavkm merged commit 6d21cf1 into dotnet:main Mar 1, 2022
@pranavkm pranavkm deleted the mvclogger branch March 1, 2022 01:00
@ghost ghost added this to the 7.0-preview3 milestone Mar 1, 2022
@@ -584,4 +584,78 @@ private sealed class ActionExecutedContextSealed : ActionExecutedContext
{
public ActionExecutedContextSealed(ActionContext actionContext, IList<IFilterMetadata> filters, object controller) : base(actionContext, filters, controller) { }
}

// Internal for unit testing
internal static new partial class Log
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Try out new .NET 6 logging generator
2 participants