Gufel.LogTemplateAnalyzer
1.0.0
dotnet add package Gufel.LogTemplateAnalyzer --version 1.0.0
NuGet\Install-Package Gufel.LogTemplateAnalyzer -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Gufel.LogTemplateAnalyzer" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Gufel.LogTemplateAnalyzer" Version="1.0.0" />
<PackageReference Include="Gufel.LogTemplateAnalyzer" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Gufel.LogTemplateAnalyzer --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Gufel.LogTemplateAnalyzer, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Gufel.LogTemplateAnalyzer@1.0.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Gufel.LogTemplateAnalyzer&version=1.0.0
#tool nuget:?package=Gufel.LogTemplateAnalyzer&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Gufel.LogTemplateAnalyzer
A Roslyn analyzer that enforces PascalCase for properties used in structured logging message templates. It helps keep your logging consistent across frameworks like Serilog and Microsoft.Extensions.Logging by flagging non-PascalCase template properties.
Features
- GLT001: Ensures all template property names (e.g.,
{UserId}
) are PascalCase - Skips positional properties like
{0}
,{1}
- Handles destructuring (
{@obj}
), alignment ({Prop,10}
), and format specifiers ({Prop:0.00}
) - Ignores interpolated strings and templates containing
nameof(...)
expressions
Installation
# Using dotnet CLI
dotnet add package Gufel.LogTemplateAnalyzer --version 1.0.0
# Or via Visual Studio NuGet Package Manager
Usage
The analyzer runs automatically once installed as a package in your project.
Example
// Triggers GLT001: "userId" should be PascalCase
_logger.LogInformation("User logged in: {userId}", userId);
// OK
_logger.LogInformation("User logged in: {UserId}", userId);
// Skipped (positional)
_logger.LogInformation("Value: {0}", value);
// Skipped (destructuring)
_logger.LogInformation("Payload: {@Payload}", payload);
// Skipped (alignment/format)
_logger.LogInformation("Value: {Value,10:0.00}", value);
Rule(s)
- GLT001: Log template property must use PascalCase
Build and Pack
# Build
dotnet build -c Release
# Pack (creates .nupkg in bin/Release)
dotnet pack -c Release
License
MIT. See LICENSE
for details.
There are no supported framework assets in this package.
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.0.0 | 149 | 9/20/2025 |