LoggingGenerator:.NET的原型源生成器模型

时间:2021-03-28 05:50:31
【文件属性】:
文件名称:LoggingGenerator:.NET的原型源生成器模型
文件大小:79KB
文件格式:ZIP
更新时间:2021-03-28 05:50:31
C# LoggingGenerator 这是一个示例,展示了我们如何为现代.NET应用程序安排具有强类型的日志记录API。 本练习的重点是创建一个日志记录模型,该模型: 使服务开发人员感到高兴 消除字符串格式 消除内存分配 启用密集二进制格式的输出 启用对组件生成的日志的更有效审核 使用非常简单。 服务开发人员创建一个类,该类列出了程序集可以生成的所有日志消息。 完成此操作后,将自动生成新方法,开发人员可以使用这些新方法与ILogger实例进行交互。 Microsoft.Extensions.Logging.Generators项目使用C#9.0源生成器。 这是在编译时调用的魔术伏都教。 此代码负责查找带有[LoggerMessage]属性注释的方法,并自动生成强类型的日志记录方法。 例子 这是由开发人员编写的示例类,其后是自动生成的代码。 static partial class L
【文件预览】:
LoggingGenerator-master
----Microsoft.Extensions.Logging.Generators.Tests()
--------Microsoft.Extensions.Logging.Generators.Test.csproj(1KB)
--------MockLogger.cs(2KB)
--------TestClasses()
--------LoggerMessageGeneratorParserTests.cs(20KB)
--------LoggerMessageGeneratorEmitterTests.cs(3KB)
--------RoslynTestUtils.cs(11KB)
--------LoggerMessageGeneratedCodeTests.cs(13KB)
----Example()
--------Log.cs(3KB)
--------Program.cs(1KB)
--------Example.csproj(1KB)
----LICENSE.TXT(1KB)
----Microsoft.Extensions.Logging.Analyzers()
--------UsingLegacyLoggingMethodFixer.FixDetails.cs(11KB)
--------UsingLegacyLoggingMethodAnalyzer.cs(3KB)
--------Resources.resx(6KB)
--------DiagDescriptors.cs(617B)
--------UsingLegacyLoggingMethodFixer.cs(25KB)
--------Resources.Designer.cs(4KB)
--------Microsoft.Extensions.Logging.Analyzers.csproj(1KB)
----Microsoft.Extensions.Logging.Extras.Tests()
--------Microsoft.Extensions.Logging.Extras.Test.csproj(1KB)
--------ArgumentFormatterTests.cs(717B)
--------LogValuesTests.cs(8KB)
--------LoggerMessageAttributeTests.cs(869B)
----.gitignore(116B)
----Microsoft.Extensions.Logging.Generators()
--------Resources.resx(12KB)
--------DiagDescriptors.cs(8KB)
--------Microsoft.Extensions.Logging.Generators.csproj(935B)
--------LoggerMessageGenerator.Emitter.cs(19KB)
--------LoggerMessageGenerator.cs(3KB)
--------LoggerMessageGenerator.Parser.cs(35KB)
--------Resources.Designer.cs(18KB)
----Microsoft.Extensions.Logging.Extras()
--------Internal()
--------LoggerMessageAttribute.cs(4KB)
--------Microsoft.Extensions.Logging.Extras.csproj(391B)
----LoggingGenerator.sln(5KB)
----Microsoft.Extensions.Logging.Analyzers.Tests()
--------Microsoft.Extensions.Logging.Analyzers.Test.csproj(1KB)
--------UsingLegacyLoggingMethodTests.cs(39KB)
--------RoslynTestUtils.cs(11KB)
----README.md(7KB)
----.editorconfig(42KB)
----Benchmark()
--------MockLogger.cs(1KB)
--------Log.cs(737B)
--------Program.cs(6KB)
--------Benchmark.csproj(884B)
----.gitattributes(194B)

网友评论