Skip to content

Add event names for logs (#6818) - #4495

Merged
pranavkm merged 2 commits into
masterfrom
prkrishn/6818
Dec 8, 2018
Merged

pranavkm merged 2 commits into
masterfrom
prkrishn/6818

Conversation

@pranavkm

@pranavkm pranavkm commented Dec 7, 2018

Copy link
Copy Markdown
Contributor

@dougbu dougbu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How visible will these new names be? If they'll appear in the output, we might want to be more consistent about Starting… -> Done… versus Before… -> After… or other conventions we've used. But, I don't see a need to block this PR for decisions on the right convention.

new EventId(28, "NoNonIndexBasedFormatFoundForCollection"),
"Could not bind to collection using a format like {ModelName}=value1&{ModelName}=value2");


Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Don't need this extra blank line

_logFilterExecutionPlan = LoggerMessage.Define<string, string[]>(
LogLevel.Debug,
1,
new EventId(1, "LogFilterExecutionPlan"),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This name doesn't look like any of the others. Suggest FilterExecutionPlan or OrderedFilterExecutionPlan.

5,
"Located compiled view for view at path '{Path}'.");

_viewCompilerLocatedCompiledViewForPath = LoggerMessage.Define<string>(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

@pranavkm

pranavkm commented Dec 8, 2018

Copy link
Copy Markdown
Contributor Author

How visible will these new names be?

From aspnet/Mvc#6818 (comment), the names appear in the log output and used for filtering. I guess it's important that it's unique, but the issue doesn't say much about the nomenclature.

@dougbu dougbu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looking even better 😸

@pranavkm
pranavkm merged commit 027bf33 into master Dec 8, 2018
@pranavkm
pranavkm deleted the prkrishn/6818 branch December 8, 2018 07:30
@pranavkm

pranavkm commented Dec 8, 2018

Copy link
Copy Markdown
Contributor Author

@Kahbazi thanks for the PR

@BrennanConroy

Copy link
Copy Markdown
Member

FYI, we try to avoid using nameof for the event names as changing them is "technically" a breaking change and it's easier to avoid accidentally changing the name by using strings instead of function names.
Couple examples: https://github.com/aspnet/AspNetCore/blob/321327f84b2b22dcff2e9beb06a9a64236c5cced/src/SignalR/src/Microsoft.AspNetCore.SignalR.Client.Core/HubConnection.Log.cs
and
https://github.com/aspnet/Extensions/blob/1878d16ecd5165849cd6a78ce708e499b71477ca/src/HttpClientFactory/Http/src/DefaultHttpClientFactory.cs#L337

@Kahbazi

Kahbazi commented Dec 8, 2018

Copy link
Copy Markdown
Member

@pranavkm you're welcome. Should I remove the nameof as @BrennanConroy said?

@pranavkm

pranavkm commented Dec 9, 2018

Copy link
Copy Markdown
Contributor Author

Should I remove the nameof as @BrennanConroy said?

Go for it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants