ScyberLog.Analyzers
2.0.0
dotnet add package ScyberLog.Analyzers --version 2.0.0
NuGet\Install-Package ScyberLog.Analyzers -Version 2.0.0
<PackageReference Include="ScyberLog.Analyzers" Version="2.0.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="ScyberLog.Analyzers" Version="2.0.0" />
<PackageReference Include="ScyberLog.Analyzers"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add ScyberLog.Analyzers --version 2.0.0
#r "nuget: ScyberLog.Analyzers, 2.0.0"
#:package ScyberLog.Analyzers@2.0.0
#addin nuget:?package=ScyberLog.Analyzers&version=2.0.0
#tool nuget:?package=ScyberLog.Analyzers&version=2.0.0
ScyberLog.Analyzers
This repository contains a single analyzer to determine if a call to one of the logging methods defined on Microsoft.Extensions.Logging.ILogger
has an invalid messaage template string. If the template is invalid, it will throw a runtime FormatException which is obviously bad because:
- Your logging framework should not be crashing your app.
- Much logging only ocurrs on the sad path, inside exception handlers, which is a place you do not want additional exceptions thrown.
- Some log calls may only occur rarely (as on particular exceptions), setting a time bomb in your application.
- You lose any information about the thing you were trying to log.
By default this diagnostic has its severity set to Error
but can be downgraded to Warning
by adding the following to your editor.config:
# AA0008: Invalid log message template format.
dotnet_diagnostic.AA0008.severity = warning
Note that there is a built-in diagnostic (CA2023) for this in the upcoming NetAnalyzers release, at which point this package will be obsolete.
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 |
---|---|---|
2.0.0 | 130 | 2/13/2025 |