Logging Generator: messaging fix (#54080)
authorJeff Layton <jeffl8n@users.noreply.github.com>
Mon, 14 Jun 2021 14:48:32 +0000 (10:48 -0400)
committerGitHub <noreply@github.com>
Mon, 14 Jun 2021 14:48:32 +0000 (07:48 -0700)
16 files changed:
src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/LoggerMessageGenerator.Parser.cs
src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/Strings.resx
src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.cs.xlf
src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.de.xlf
src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.es.xlf
src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.fr.xlf
src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.it.xlf
src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ja.xlf
src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ko.xlf
src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.pl.xlf
src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.pt-BR.xlf
src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ru.xlf
src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.tr.xlf
src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.zh-Hans.xlf
src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.zh-Hant.xlf
src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorParserTests.cs

index 03c5ad2..8542778 100644 (file)
@@ -323,7 +323,7 @@ namespace Microsoft.Extensions.Logging.Generators
 
                                                 if (!found)
                                                 {
-                                                    Diag(DiagnosticDescriptors.TemplateHasNoCorrespondingArgument, ma.GetLocation(), t);
+                                                    Diag(DiagnosticDescriptors.TemplateHasNoCorrespondingArgument, ma.GetLocation(), t.Key);
                                                 }
                                             }
                                         }
index 13a23bc..ed06151 100644 (file)
     <value>Argument is not referenced from the logging message</value>
   </data>
   <data name="TemplateHasNoCorrespondingArgumentMessage" xml:space="preserve">
-    <value>Template {0} is not provided as argument to the logging method</value>
+    <value>Template '{0}' is not provided as argument to the logging method</value>
   </data>
   <data name="TemplateHasNoCorrespondingArgumentTitle" xml:space="preserve">
     <value>Logging template has no corresponding method argument</value>
index 8a6e5be..980f5e2 100644 (file)
         <note />
       </trans-unit>
       <trans-unit id="TemplateHasNoCorrespondingArgumentMessage">
-        <source>Template {0} is not provided as argument to the logging method</source>
-        <target state="new">Template {0} is not provided as argument to the logging method</target>
+        <source>Template '{0}' is not provided as argument to the logging method</source>
+        <target state="new">Template '{0}' is not provided as argument to the logging method</target>
         <note />
       </trans-unit>
       <trans-unit id="TemplateHasNoCorrespondingArgumentTitle">
index 835dfbb..3c5bd3f 100644 (file)
         <note />
       </trans-unit>
       <trans-unit id="TemplateHasNoCorrespondingArgumentMessage">
-        <source>Template {0} is not provided as argument to the logging method</source>
-        <target state="new">Template {0} is not provided as argument to the logging method</target>
+        <source>Template '{0}' is not provided as argument to the logging method</source>
+        <target state="new">Template '{0}' is not provided as argument to the logging method</target>
         <note />
       </trans-unit>
       <trans-unit id="TemplateHasNoCorrespondingArgumentTitle">
index 0db7b4e..3678d12 100644 (file)
         <note />
       </trans-unit>
       <trans-unit id="TemplateHasNoCorrespondingArgumentMessage">
-        <source>Template {0} is not provided as argument to the logging method</source>
-        <target state="new">Template {0} is not provided as argument to the logging method</target>
+        <source>Template '{0}' is not provided as argument to the logging method</source>
+        <target state="new">Template '{0}' is not provided as argument to the logging method</target>
         <note />
       </trans-unit>
       <trans-unit id="TemplateHasNoCorrespondingArgumentTitle">
index 757ff65..aa1939b 100644 (file)
         <note />
       </trans-unit>
       <trans-unit id="TemplateHasNoCorrespondingArgumentMessage">
-        <source>Template {0} is not provided as argument to the logging method</source>
-        <target state="new">Template {0} is not provided as argument to the logging method</target>
+        <source>Template '{0}' is not provided as argument to the logging method</source>
+        <target state="new">Template '{0}' is not provided as argument to the logging method</target>
         <note />
       </trans-unit>
       <trans-unit id="TemplateHasNoCorrespondingArgumentTitle">
index 8717aa3..cf54d51 100644 (file)
         <note />
       </trans-unit>
       <trans-unit id="TemplateHasNoCorrespondingArgumentMessage">
-        <source>Template {0} is not provided as argument to the logging method</source>
-        <target state="new">Template {0} is not provided as argument to the logging method</target>
+        <source>Template '{0}' is not provided as argument to the logging method</source>
+        <target state="new">Template '{0}' is not provided as argument to the logging method</target>
         <note />
       </trans-unit>
       <trans-unit id="TemplateHasNoCorrespondingArgumentTitle">
index 9ed2e74..70ccaa7 100644 (file)
         <note />
       </trans-unit>
       <trans-unit id="TemplateHasNoCorrespondingArgumentMessage">
-        <source>Template {0} is not provided as argument to the logging method</source>
-        <target state="new">Template {0} is not provided as argument to the logging method</target>
+        <source>Template '{0}' is not provided as argument to the logging method</source>
+        <target state="new">Template '{0}' is not provided as argument to the logging method</target>
         <note />
       </trans-unit>
       <trans-unit id="TemplateHasNoCorrespondingArgumentTitle">
index 5b7bbb9..c7248aa 100644 (file)
         <note />
       </trans-unit>
       <trans-unit id="TemplateHasNoCorrespondingArgumentMessage">
-        <source>Template {0} is not provided as argument to the logging method</source>
-        <target state="new">Template {0} is not provided as argument to the logging method</target>
+        <source>Template '{0}' is not provided as argument to the logging method</source>
+        <target state="new">Template '{0}' is not provided as argument to the logging method</target>
         <note />
       </trans-unit>
       <trans-unit id="TemplateHasNoCorrespondingArgumentTitle">
index eed366e..4752235 100644 (file)
         <note />
       </trans-unit>
       <trans-unit id="TemplateHasNoCorrespondingArgumentMessage">
-        <source>Template {0} is not provided as argument to the logging method</source>
-        <target state="new">Template {0} is not provided as argument to the logging method</target>
+        <source>Template '{0}' is not provided as argument to the logging method</source>
+        <target state="new">Template '{0}' is not provided as argument to the logging method</target>
         <note />
       </trans-unit>
       <trans-unit id="TemplateHasNoCorrespondingArgumentTitle">
index c33ad19..da1942b 100644 (file)
         <note />
       </trans-unit>
       <trans-unit id="TemplateHasNoCorrespondingArgumentMessage">
-        <source>Template {0} is not provided as argument to the logging method</source>
-        <target state="new">Template {0} is not provided as argument to the logging method</target>
+        <source>Template '{0}' is not provided as argument to the logging method</source>
+        <target state="new">Template '{0}' is not provided as argument to the logging method</target>
         <note />
       </trans-unit>
       <trans-unit id="TemplateHasNoCorrespondingArgumentTitle">
index 37548b1..ed2de8c 100644 (file)
         <note />
       </trans-unit>
       <trans-unit id="TemplateHasNoCorrespondingArgumentMessage">
-        <source>Template {0} is not provided as argument to the logging method</source>
-        <target state="new">Template {0} is not provided as argument to the logging method</target>
+        <source>Template '{0}' is not provided as argument to the logging method</source>
+        <target state="new">Template '{0}' is not provided as argument to the logging method</target>
         <note />
       </trans-unit>
       <trans-unit id="TemplateHasNoCorrespondingArgumentTitle">
index dccdbd5..4b86ee0 100644 (file)
         <note />
       </trans-unit>
       <trans-unit id="TemplateHasNoCorrespondingArgumentMessage">
-        <source>Template {0} is not provided as argument to the logging method</source>
-        <target state="new">Template {0} is not provided as argument to the logging method</target>
+        <source>Template '{0}' is not provided as argument to the logging method</source>
+        <target state="new">Template '{0}' is not provided as argument to the logging method</target>
         <note />
       </trans-unit>
       <trans-unit id="TemplateHasNoCorrespondingArgumentTitle">
index 98b2d4b..87f8d9b 100644 (file)
         <note />
       </trans-unit>
       <trans-unit id="TemplateHasNoCorrespondingArgumentMessage">
-        <source>Template {0} is not provided as argument to the logging method</source>
-        <target state="new">Template {0} is not provided as argument to the logging method</target>
+        <source>Template '{0}' is not provided as argument to the logging method</source>
+        <target state="new">Template '{0}' is not provided as argument to the logging method</target>
         <note />
       </trans-unit>
       <trans-unit id="TemplateHasNoCorrespondingArgumentTitle">
index 0a54ae2..a34749c 100644 (file)
         <note />
       </trans-unit>
       <trans-unit id="TemplateHasNoCorrespondingArgumentMessage">
-        <source>Template {0} is not provided as argument to the logging method</source>
-        <target state="new">Template {0} is not provided as argument to the logging method</target>
+        <source>Template '{0}' is not provided as argument to the logging method</source>
+        <target state="new">Template '{0}' is not provided as argument to the logging method</target>
         <note />
       </trans-unit>
       <trans-unit id="TemplateHasNoCorrespondingArgumentTitle">
index e3e62f7..bb158e9 100644 (file)
@@ -93,6 +93,7 @@ namespace Microsoft.Extensions.Logging.Generators.Tests
 
             Assert.Single(diagnostics);
             Assert.Equal(DiagnosticDescriptors.TemplateHasNoCorrespondingArgument.Id, diagnostics[0].Id);
+            Assert.Contains("Template 'foo' is not provided as argument to the logging method", diagnostics[0].GetMessage(), StringComparison.InvariantCulture);
         }
 
         [Fact]