Skip to content

LoggerMessage - Allow Event ID to be optional #52223

Closed

Description

@maryamariyan

Using LoggerMessage attribute today required each logging method to have a unique event ID in a given class.
Otherwise, we get a warning SYSLIB1006, stating we should not be reusing event IDs.

This issue tracks allowing uses of the LoggerMessage attribute without defining an event ID, but, adding a Roslyn Analyzer that warns/errors to recommend best practices.

This is more useful for library developers than it is for app developers which most times might want to cut corners and skip providing event IDs.

Originally requested in dotnet/designs#195 (comment).

cc: @loic-sharma @shirhatti


UPDATE

How to address:

When event ID is not set, it will default to -1, when multiple logging methods in a class don't have event ID set, they all default to -1, causing the SYSLIB1006 warning.

Activity

  1. added this to the 6.0.0 milestone on May 3, 2021
  2. ghost added
    untriagedNew issue has not been triaged by the area owner
    on May 3, 2021
  3. removed
    untriagedNew issue has not been triaged by the area owner
    on May 3, 2021
  4. maryamariyan commented on Jun 23, 2021

    @maryamariyan
    ContributorAuthor

    Closed via #54305

  5. ghost locked as resolved and limited conversation to collaborators on Jul 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions