dotnet/runtime

[Analyzer] Replacing direct LoggerExtensions.Log* usage with source-generated logging methods

Open

#78.406 geöffnet am 15. Nov. 2022

Auf GitHub ansehen
 (11 Kommentare) (3 Reaktionen) (0 zugewiesene Personen)C# (5.445 Forks)batch import
api-approvedarea-Extensions-Loggingcode-analyzercode-fixerhelp wantedpartner-impact

Repository-Metriken

Stars
 (17.886 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 12T 11h) (661 gemergte PRs in 30 T)

Beschreibung

Just as we have a regex source generator analyzer that flags use of Regex and creates a replacement that uses the source generator, we should consider an analyzer that will push code to use the logging source generator. The analyzer would flag direct use of LoggerExtensions.Log* methods and recommend replacing them with use of the logging generator, with the fixer generating a partial method stub for the generator and changing the call site to use it.

Performance rules Category Severity = none (off by default)

Contributor Guide