MicrosoftLogger.Analyzer 1.0.2

dotnet add package MicrosoftLogger.Analyzer --version 1.0.2
                    
NuGet\Install-Package MicrosoftLogger.Analyzer -Version 1.0.2
                    
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="MicrosoftLogger.Analyzer" Version="1.0.2">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MicrosoftLogger.Analyzer" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="MicrosoftLogger.Analyzer">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
Project file
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 MicrosoftLogger.Analyzer --version 1.0.2
                    
#r "nuget: MicrosoftLogger.Analyzer, 1.0.2"
                    
#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 MicrosoftLogger.Analyzer@1.0.2
                    
#: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=MicrosoftLogger.Analyzer&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=MicrosoftLogger.Analyzer&version=1.0.2
                    
Install as a Cake Tool

MicrosoftLogger.Analyzer

Analyzer helps you to find ILogger<TCategoryName> with wrong category name and fix it

Installation

To install MicrosoftLogger.Analyzer, run the following command:

dotnet add package MicrosoftLogger.Analyzer

Description

When you use Microsoft.Extensions.Logging.ILogger<TCategoryName>, you usually resolve it from dependency injection and set current class as the generic parameter.

The class is used as a category name in logs. You can filter logs by category, you can set a specific log level for category. Because of that, you must set the right class for the generic parameter of ILogger.

Often there are mistakes in ILogger<TCategoryName>. MicrosoftLogger.Analyzer analyzes class constructors and helps you to find and fix mistakes. Diagnostic example

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.2 42,831 12/25/2022
1.0.1 414 12/19/2022
1.0.0 486 12/12/2022

Thanks to Gérald Barré(@meziantou) for helping improve performance of the analyzer