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

Add LoggingGenerator #51064

Merged
merged 123 commits into from
Apr 16, 2021
Merged
Show file tree
Hide file tree
Changes from 88 commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
71cf1eb
Rejigger project names
Nov 17, 2020
afd85ab
Update namespaces
Nov 17, 2020
fe21a95
Nuke the temporary .Attributes namespace
Nov 17, 2020
b6281b5
Add error checking to prevent multiple logging messages from using th…
Nov 17, 2020
ca3ead4
Use ISyntaxReceiver to be more IDE friendly
jaredpar Nov 17, 2020
470b160
Finish implementation of exception support
Nov 17, 2020
515f029
Make the generated type have the same access modifiers as the input i…
Nov 17, 2020
6affdd8
Enforce that logging methods must return void
Nov 17, 2020
7f15797
Cleanup how semantic models are handled
Nov 18, 2020
8b3cdaa
Prevent generic interfaces or methods.
Nov 18, 2020
1c0e756
Improve efficiency of the generated code for log messages without tem…
Nov 18, 2020
5893090
Various cleanup items
Nov 18, 2020
56943dd
Few small changes (#3)
davidfowl Nov 18, 2020
056e81c
Minor refactoring
Nov 18, 2020
b72ec2d
More refactoring
Nov 18, 2020
4ab2acc
Support partial methods (#4)
davidfowl Nov 19, 2020
0718293
Optimize some code gen.
Nov 19, 2020
d065c90
Simplify the model. You can now only annotate partial methods
Nov 19, 2020
d99cec0
Improve code generation by statically defining delegate types
Nov 20, 2020
b31bca8
Simplify generated code
Nov 20, 2020
1a4e336
Revamp code gen to shrink jitted size
Nov 21, 2020
128f5d2
Bunch of improvements.
Nov 22, 2020
3740b68
Enable localization of error messages
Nov 22, 2020
e275551
Substantially reduce the size of the generated code
Nov 22, 2020
fc8ce48
Add unit tests for Microsoft.Extensions.Logging.Attributes
Nov 22, 2020
951f5cc
Renamed the *Attributes assembly to *Extras
Nov 22, 2020
bf36548
Remove an allocation that snuck in during the last batch of optimizat…
Nov 22, 2020
b773ce8
Add a few more tests
Nov 22, 2020
6b25016
Use proper code to get fully-qualified type names
Nov 22, 2020
1eb4e9f
Add support for message strings containing linefeeds or quotes
Nov 22, 2020
bb45336
Add support for logging messages containing carriage returns.
Nov 22, 2020
e979d5f
Use static analysis consistently
Nov 22, 2020
c459d32
More tests, and a fix for string formatting of large cardinality log …
Nov 22, 2020
14530de
Add code coverage for logging generator error paths
Nov 22, 2020
d0ebfb2
Readme update
Nov 22, 2020
6354e8f
Add support for early termination via the cancellation token
Nov 23, 2020
8ece920
Improvements in the code generator's performance
Nov 23, 2020
0167f30
Produce an error when [LoggerMessage] is applied to a non-partial met…
Nov 23, 2020
9915bbd
Add support for generic parameters for logging methods
Nov 23, 2020
43f671c
Add support for 'protected internal' and 'protected private' logging …
Nov 23, 2020
66310a1
Minor cleanup
Nov 23, 2020
58709eb
Improved code gen for log levels, and add level unit tests
Nov 23, 2020
11b5ef1
Add support for ToString in the log state
Nov 23, 2020
da8099b
Introduce an analyzer.
Nov 25, 2020
dd39eba
Combine the fixer into the analyzer assembly.
Nov 25, 2020
a93b5c0
Introduce analyzer and fixer functionality
Nov 27, 2020
17d3a5b
More stuff.
Nov 28, 2020
561dbf3
More tests, and ensuing bug fixes.
Nov 28, 2020
8f94d10
Tests and fixes
Nov 29, 2020
34d2237
Finish support for nullable logging args, and extension logging methods
Nov 30, 2020
6fabebc
Add license file and a bit of info in the README
Nov 30, 2020
438f2bb
Improve generator's perf to minimize the impact on the IDE
Dec 1, 2020
3fd97a1
Refactor the main generator class to allow unit testing of the produc…
Dec 1, 2020
9c6c08b
More test coverage, more resulting fixes
Dec 1, 2020
71fd60a
Make the source generator robust to malformed source
Dec 2, 2020
4424c8b
More testing and tweaking
Dec 2, 2020
bb33d1c
More coverage, more fixes
Dec 3, 2020
c89bb35
Relocate using statements
Dec 9, 2020
755f3ff
Cleanup analyzer story
Dec 11, 2020
225b63d
Refactoring and cleanup
Dec 26, 2020
139e5bb
Get coverage to 100%
Dec 29, 2020
e8db38a
A few improvements
Mar 8, 2021
5e3d279
Variety of improvements.
Mar 14, 2021
00cac9b
Various improvements.
Mar 15, 2021
9e150d9
Add support for logging methods as instance methods
Mar 15, 2021
83eb36e
Minor cleanup
Mar 15, 2021
cc44192
Various improvements
Mar 16, 2021
b611bbd
Rename LogStateHolder to LogValues
Mar 16, 2021
60fef62
Improve test coverage
Mar 16, 2021
79dc2d4
Use the Invariant culture when formatting log messages
Mar 17, 2021
055cf3f
Improve the error message around id reuse
Mar 27, 2021
abb5010
A few improvements
Mar 27, 2021
9087427
Emit GenerateCodeAttribute instead of CompilerGeneratedAttribute
Mar 30, 2021
58b3369
Minor cleanup items
Mar 31, 2021
82f1611
Added preliminary support for an alternate code gen strategy
Mar 31, 2021
bb63032
Overhaul of the emitter.
Apr 9, 2021
5f210fc
Address more feedback and bugs
Apr 10, 2021
fe54581
Two nit fixes
maryamariyan Apr 10, 2021
407a9e8
Merge pull request #2 from maryamariyan/nit-fixes
maryamariyan Apr 10, 2021
b1f5364
API Review feedback: LoggerMessageAttribute (#4)
maryamariyan Apr 10, 2021
3afda5f
Merge branch 'logging-generator' of /Users/maryam/CodeHub/LoggingGene…
maryamariyan Apr 10, 2021
b7b2928
- Update header license
maryamariyan Apr 10, 2021
c41c463
Minor renames, also added project to solution file
maryamariyan Apr 10, 2021
3ef2083
- Add LoggerMessageAttribute - ref/src
maryamariyan Apr 11, 2021
a7eba74
- Add localization and packaging
maryamariyan Apr 11, 2021
ba71c47
- ActiveIssue for Mono
maryamariyan Apr 11, 2021
4cb1466
Complete one TODO: use available SYSLIBXXXX values
maryamariyan Apr 11, 2021
daf1a7a
Fix path to pick up root folder
maryamariyan Apr 11, 2021
3a97c73
- Add versions to versions.props
maryamariyan Apr 13, 2021
946f764
- Switch ActiveIssue from closed to dupe one.
maryamariyan Apr 13, 2021
80840e6
- Move RoslynTestUtils to common folder
maryamariyan Apr 13, 2021
5637b69
Remove suppressed warnings
maryamariyan Apr 13, 2021
0cc8316
Added ActiveIssue for roslyn issue
maryamariyan Apr 13, 2021
1297f11
Rename DiagDescriptors to DiagnosticDescriptors
maryamariyan Apr 13, 2021
2add7ce
- Remove LangVersions from csproj
maryamariyan Apr 13, 2021
13631d2
- Remove Moq
maryamariyan Apr 13, 2021
d9970f7
- Skip on browser Cant load Microsoft.CodeAnalysis
maryamariyan Apr 13, 2021
d809dad
- Add CLSCompliant on gen csproj
maryamariyan Apr 13, 2021
dd51c53
- Add record of SYSLIBXXXX in the md file
maryamariyan Apr 14, 2021
70f24ef
- Rename md file to list-of-diagnostics.md
maryamariyan Apr 14, 2021
afb43d7
- Add a set of baseline files to test against
maryamariyan Apr 14, 2021
2d41c6d
- Fix new line issue when comparing baselines
maryamariyan Apr 14, 2021
7e68b1c
Add Generator and Resources to the Logging package
ericstj Apr 14, 2021
9200131
Refactor part 1
maryamariyan Apr 14, 2021
6a71553
Fixup whitespaces after removing try/finally
maryamariyan Apr 14, 2021
7547f38
Refactor part 2
maryamariyan Apr 15, 2021
6eab93d
- Remove duplication in the resource string values
maryamariyan Apr 15, 2021
cc0bb07
Replace operations using StringComparison.Ordinal
maryamariyan Apr 15, 2021
e56d447
Include generator project to src.proj
maryamariyan Apr 15, 2021
b970fdd
Upgrade generator package versions
maryamariyan Apr 15, 2021
bd93ccf
- Can't have a log level set twice
maryamariyan Apr 15, 2021
a6ecab3
Add three more diagnostics
maryamariyan Apr 15, 2021
35a584c
Use wildcard, include gen projects under NonNetCoreApp
maryamariyan Apr 15, 2021
0ec16c4
Renames only
maryamariyan Apr 15, 2021
e81015d
- Use other Define overload using skipEnabledCheck
maryamariyan Apr 15, 2021
1b7a158
Revert "Upgrade generator package versions"
maryamariyan Apr 15, 2021
d94e42f
Block range for logging in MD file
maryamariyan Apr 15, 2021
a2f18d9
enable nullable on test project
maryamariyan Apr 16, 2021
e110684
Add missing "global::" to types
maryamariyan Apr 16, 2021
ba9b77f
Fix up triple slash comments for LoggerMessageAttribute
maryamariyan Apr 16, 2021
843c0f3
lock strings
maryamariyan Apr 16, 2021
65b1f51
- Feedback on RoslynTestUtils
maryamariyan Apr 16, 2021
c0c22ce
- Enable nullable on csproj
maryamariyan Apr 16, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{62569F09-F90
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{35D3ECF9-E321-4AA6-BF5B-41E7AC54A620}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "gen", "gen", "{9E96ED55-37A0-4007-854D-F3E3526E3CC0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Generators", "gen\Microsoft.Extensions.Logging.Generators.csproj", "{56A5DED2-47C2-4938-931E-B896A6BDDA0D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Encodings.Web", "..\System.Text.Encodings.Web\ref\System.Text.Encodings.Web.csproj", "{58614FD7-05BC-46A8-900D-AC5B8622C724}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json", "..\System.Text.Json\ref\System.Text.Json.csproj", "{F7E444A4-124D-48E2-B311-17A5ED8B0CC2}"
Expand All @@ -149,6 +153,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Diagnostics.Diagnost
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Threading.AccessControl", "..\System.Threading.AccessControl\ref\System.Threading.AccessControl.csproj", "{5FF1A443-F491-428F-9121-51523AA65052}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Generators.Tests", "tests\Microsoft.Extensions.Logging.Generators.Tests\Microsoft.Extensions.Logging.Generators.Tests.csproj", "{8C0151F9-1FC9-4D9B-A5B1-60C7B8E7B761}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -419,6 +425,10 @@ Global
{1E1B25F0-7B14-4798-BBF4-156A52949CBA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1E1B25F0-7B14-4798-BBF4-156A52949CBA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1E1B25F0-7B14-4798-BBF4-156A52949CBA}.Release|Any CPU.Build.0 = Release|Any CPU
{56A5DED2-47C2-4938-931E-B896A6BDDA0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{56A5DED2-47C2-4938-931E-B896A6BDDA0D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{56A5DED2-47C2-4938-931E-B896A6BDDA0D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{56A5DED2-47C2-4938-931E-B896A6BDDA0D}.Release|Any CPU.Build.0 = Release|Any CPU
{58614FD7-05BC-46A8-900D-AC5B8622C724}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{58614FD7-05BC-46A8-900D-AC5B8622C724}.Debug|Any CPU.Build.0 = Debug|Any CPU
{58614FD7-05BC-46A8-900D-AC5B8622C724}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -435,6 +445,10 @@ Global
{5FF1A443-F491-428F-9121-51523AA65052}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5FF1A443-F491-428F-9121-51523AA65052}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5FF1A443-F491-428F-9121-51523AA65052}.Release|Any CPU.Build.0 = Release|Any CPU
{8C0151F9-1FC9-4D9B-A5B1-60C7B8E7B761}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8C0151F9-1FC9-4D9B-A5B1-60C7B8E7B761}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8C0151F9-1FC9-4D9B-A5B1-60C7B8E7B761}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8C0151F9-1FC9-4D9B-A5B1-60C7B8E7B761}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -506,10 +520,12 @@ Global
{504464B5-B163-4D6B-A113-52DDC78A401D} = {35D3ECF9-E321-4AA6-BF5B-41E7AC54A620}
{7467E5B1-7454-4277-A84F-E8BE34A80CE4} = {62569F09-F901-4240-B3E1-E2FF90544D74}
{1E1B25F0-7B14-4798-BBF4-156A52949CBA} = {35D3ECF9-E321-4AA6-BF5B-41E7AC54A620}
{56A5DED2-47C2-4938-931E-B896A6BDDA0D} = {9E96ED55-37A0-4007-854D-F3E3526E3CC0}
{58614FD7-05BC-46A8-900D-AC5B8622C724} = {62569F09-F901-4240-B3E1-E2FF90544D74}
{F7E444A4-124D-48E2-B311-17A5ED8B0CC2} = {62569F09-F901-4240-B3E1-E2FF90544D74}
{5B5AFA97-C1FC-47B9-AB7A-6A10E0285282} = {62569F09-F901-4240-B3E1-E2FF90544D74}
{5FF1A443-F491-428F-9121-51523AA65052} = {62569F09-F901-4240-B3E1-E2FF90544D74}
{8C0151F9-1FC9-4D9B-A5B1-60C7B8E7B761} = {88957302-AFDD-4923-BF5A-336EAB5F28B7}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B57B7C13-740F-4482-B7B6-B5E87014ACB1}
Expand Down
171 changes: 171 additions & 0 deletions src/libraries/Microsoft.Extensions.Logging/gen/DiagDescriptors.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using Microsoft.CodeAnalysis;

namespace Microsoft.Extensions.Logging.Generators
{
internal static class DiagDescriptors
maryamariyan marked this conversation as resolved.
Show resolved Hide resolved
{
public static DiagnosticDescriptor InvalidLoggingMethodName { get; } = new (
id: "SYSLIB0013",
maryamariyan marked this conversation as resolved.
Show resolved Hide resolved
title: new LocalizableResourceString(nameof(SR.InvalidLoggingMethodNameTitle), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
messageFormat: new LocalizableResourceString(nameof(SR.InvalidLoggingMethodNameMessage), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
category: "LoggingGenerator",
DiagnosticSeverity.Error,
isEnabledByDefault: true);

public static DiagnosticDescriptor ShouldntMentionLogLevelInMessage { get; } = new (
id: "SYSLIB0014",
title: new LocalizableResourceString(nameof(SR.ShouldntMentionLogLevelInMessageTitle), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
messageFormat: new LocalizableResourceString(nameof(SR.ShouldntMentionLogLevelInMessageMessage), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
category: "LoggingGenerator",
DiagnosticSeverity.Warning,
isEnabledByDefault: true);

public static DiagnosticDescriptor InvalidLoggingMethodParameterName { get; } = new (
id: "SYSLIB0015",
title: new LocalizableResourceString(nameof(SR.InvalidLoggingMethodParameterNameTitle), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
messageFormat: new LocalizableResourceString(nameof(SR.InvalidLoggingMethodParameterNameMessage), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
category: "LoggingGenerator",
DiagnosticSeverity.Error,
isEnabledByDefault: true);

public static DiagnosticDescriptor LoggingMethodInNestedType { get; } = new (
id: "SYSLIB0016",
title: new LocalizableResourceString(nameof(SR.LoggingMethodInNestedTypeTitle), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
messageFormat: new LocalizableResourceString(nameof(SR.LoggingMethodInNestedTypeMessage), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
category: "LoggingGenerator",
DiagnosticSeverity.Error,
isEnabledByDefault: true);

public static DiagnosticDescriptor MissingRequiredType { get; } = new (
id: "SYSLIB0017",
title: new LocalizableResourceString(nameof(SR.MissingRequiredTypeTitle), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
messageFormat: new LocalizableResourceString(nameof(SR.MissingRequiredTypeMessage), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
category: "LoggingGenerator",
DiagnosticSeverity.Error,
isEnabledByDefault: true);

public static DiagnosticDescriptor ShouldntReuseEventIds { get; } = new (
id: "SYSLIB0018",
title: new LocalizableResourceString(nameof(SR.ShouldntReuseEventIdsTitle), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
messageFormat: new LocalizableResourceString(nameof(SR.ShouldntReuseEventIdsMessage), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
category: "LoggingGenerator",
DiagnosticSeverity.Warning,
isEnabledByDefault: true);

public static DiagnosticDescriptor LoggingMethodMustReturnVoid { get; } = new (
id: "SYSLIB0019",
title: new LocalizableResourceString(nameof(SR.LoggingMethodMustReturnVoidTitle), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
messageFormat: new LocalizableResourceString(nameof(SR.LoggingMethodMustReturnVoidMessage), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
category: "LoggingGenerator",
DiagnosticSeverity.Error,
isEnabledByDefault: true);

public static DiagnosticDescriptor MissingLoggerArgument { get; } = new (
id: "SYSLIB0020",
title: new LocalizableResourceString(nameof(SR.MissingLoggerArgumentTitle), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
messageFormat: new LocalizableResourceString(nameof(SR.MissingLoggerArgumentMessage), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
category: "LoggingGenerator",
DiagnosticSeverity.Error,
isEnabledByDefault: true);

public static DiagnosticDescriptor LoggingMethodShouldBeStatic { get; } = new (
id: "SYSLIB0021",
title: new LocalizableResourceString(nameof(SR.LoggingMethodShouldBeStaticTitle), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
messageFormat: new LocalizableResourceString(nameof(SR.LoggingMethodShouldBeStaticMessage), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
category: "LoggingGenerator",
DiagnosticSeverity.Warning,
isEnabledByDefault: true);

public static DiagnosticDescriptor LoggingMethodMustBePartial { get; } = new (
id: "SYSLIB0022",
title: new LocalizableResourceString(nameof(SR.LoggingMethodMustBePartialTitle), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
messageFormat: new LocalizableResourceString(nameof(SR.LoggingMethodMustBePartialMessage), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
category: "LoggingGenerator",
DiagnosticSeverity.Error,
isEnabledByDefault: true);

public static DiagnosticDescriptor LoggingMethodIsGeneric { get; } = new (
id: "SYSLIB0023",
title: new LocalizableResourceString(nameof(SR.LoggingMethodIsGenericTitle), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
messageFormat: new LocalizableResourceString(nameof(SR.LoggingMethodIsGenericMessage), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
category: "LoggingGenerator",
DiagnosticSeverity.Error,
isEnabledByDefault: true);

public static DiagnosticDescriptor RedundantQualifierInMessage { get; } = new (
id: "SYSLIB0024",
title: new LocalizableResourceString(nameof(SR.RedundantQualifierInMessageTitle), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
messageFormat: new LocalizableResourceString(nameof(SR.RedundantQualifierInMessageMessage), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
category: "LoggingGenerator",
DiagnosticSeverity.Warning,
isEnabledByDefault: true);

public static DiagnosticDescriptor ShouldntMentionExceptionInMessage { get; } = new (
id: "SYSLIB0025",
title: new LocalizableResourceString(nameof(SR.ShouldntMentionExceptionInMessageTitle), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
messageFormat: new LocalizableResourceString(nameof(SR.ShouldntMentionExceptionInMessageMessage), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
category: "LoggingGenerator",
DiagnosticSeverity.Warning,
isEnabledByDefault: true);

public static DiagnosticDescriptor TemplateHasNoCorrespondingArgument { get; } = new (
id: "SYSLIB0026",
title: new LocalizableResourceString(nameof(SR.TemplateHasNoCorrespondingArgumentTitle), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
messageFormat: new LocalizableResourceString(nameof(SR.TemplateHasNoCorrespondingArgumentMessage), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
category: "LoggingGenerator",
DiagnosticSeverity.Error,
isEnabledByDefault: true);

public static DiagnosticDescriptor ArgumentHasNoCorrespondingTemplate { get; } = new (
id: "SYSLIB0027",
title: new LocalizableResourceString(nameof(SR.ArgumentHasNoCorrespondingTemplateTitle), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
messageFormat: new LocalizableResourceString(nameof(SR.ArgumentHasNoCorrespondingTemplateMessage), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
category: "LoggingGenerator",
DiagnosticSeverity.Warning,
isEnabledByDefault: true);

public static DiagnosticDescriptor LoggingMethodHasBody { get; } = new (
id: "SYSLIB0028",
title: new LocalizableResourceString(nameof(SR.LoggingMethodHasBodyTitle), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
messageFormat: new LocalizableResourceString(nameof(SR.LoggingMethodHasBodyMessage), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
category: "LoggingGenerator",
DiagnosticSeverity.Error,
isEnabledByDefault: true);

public static DiagnosticDescriptor MissingLogLevel { get; } = new (
id: "SYSLIB0029",
title: new LocalizableResourceString(nameof(SR.MissingLogLevelTitle), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
messageFormat: new LocalizableResourceString(nameof(SR.MissingLogLevelMessage), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
category: "LoggingGenerator",
DiagnosticSeverity.Error,
isEnabledByDefault: true);

public static DiagnosticDescriptor ShouldntMentionLoggerInMessage { get; } = new (
id: "SYSLIB0030",
title: new LocalizableResourceString(nameof(SR.ShouldntMentionLoggerInMessageTitle), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
messageFormat: new LocalizableResourceString(nameof(SR.ShouldntMentionLoggerInMessageMessage), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
category: "LoggingGenerator",
DiagnosticSeverity.Warning,
isEnabledByDefault: true);

public static DiagnosticDescriptor MissingLoggerField { get; } = new (
id: "SYSLIB0031",
title: new LocalizableResourceString(nameof(SR.MissingLoggerFieldTitle), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
messageFormat: new LocalizableResourceString(nameof(SR.MissingLoggerFieldMessage), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
category: "LoggingGenerator",
DiagnosticSeverity.Error,
isEnabledByDefault: true);

public static DiagnosticDescriptor MultipleLoggerFields { get; } = new(
id: "SYSLIB0032",
title: new LocalizableResourceString(nameof(SR.MultipleLoggerFieldsTitle), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
messageFormat: new LocalizableResourceString(nameof(SR.MultipleLoggerFieldsMessage), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)),
category: "LoggingGenerator",
DiagnosticSeverity.Error,
isEnabledByDefault: true);
}
}
Loading