Skip to content

Fix inaccurate LogLevel constraint in LoggerMessageAttribute remarks - #130320

Merged
tarekgh merged 3 commits into
dotnet:mainfrom
tarekgh:fix-loggermessage-loglevel-remarks
Jul 8, 2026
Merged

tarekgh merged 3 commits into
dotnet:mainfrom
tarekgh:fix-loggermessage-loglevel-remarks

Conversation

@tarekgh

@tarekgh tarekgh commented Jul 7, 2026

Copy link
Copy Markdown
Member

The remarks for LoggerMessageAttribute incorrectly stated that the decorated method must have a LogLevel parameter. The log level can instead be set on the attribute (via a constructor or the Level property), and defaults to LogLevel.None when unspecified. Updated the remarks accordingly.

Fixes #130319

Copilot AI review requested due to automatic review settings July 7, 2026 21:04
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/area-extensions-logging
See info in area-owners.md if you want to be subscribed.

Copilot AI 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.

Pull request overview

This PR updates the XML documentation remarks on Microsoft.Extensions.Logging.LoggerMessageAttribute to correct the stated requirements around how a log level is provided to the source generator.

Changes:

  • Updates the remarks bullet that previously claimed the method must include a LogLevel parameter.
  • Documents alternative ways to provide the log level (attribute ctor / Level property vs. method parameter).

The log level can be set on the attribute (via a constructor or the Level property) instead of a method parameter.

@gewarren gewarren 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.

Thank you!

Copilot AI review requested due to automatic review settings July 8, 2026 16:36

Copilot AI 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.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Copilot AI review requested due to automatic review settings July 8, 2026 16:44

@svick svick left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Copilot AI 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.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@tarekgh
tarekgh merged commit 66dedd6 into dotnet:main Jul 8, 2026
88 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jul 10, 2026
eiriktsarpalis pushed a commit that referenced this pull request Jul 15, 2026
…130320)

The remarks for `LoggerMessageAttribute` incorrectly stated that the
decorated method must have a `LogLevel` parameter. The log level can
instead be set on the attribute (via a constructor or the `Level`
property), and defaults to `LogLevel.None` when unspecified. Updated the
remarks accordingly.

Fixes #130319

---------

Co-authored-by: Tarek Mahmoud Sayed <[email protected]>
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Microsoft.Extensions.Logging.LoggerMessageAttribute remarks specify unnecessary constraint (.net 10/11)

4 participants