rspec/rules/S3416/csharp/why-exception-example.adoc
Antonio Aversa 951c7da4b7
Modify rule S3416: add C# and VB.NET (#2528)
* Modify rule S3416: add C# and VB.NET

* Add logging frameworks to the list of allowed frameworks

* Reverse adding logging frameworks

* Fix issues from adoc validation

* Review 1

* Fix tabbing

* Review 2

* Add list of supported frameworks

* Missed renames

* Add 'logging' tag

* Remove VB.NET

* Fix a minor typo

---------

Co-authored-by: Gregory Paidis <gregory.paidis@sonarsource.com>
Co-authored-by: Gregory Paidis <115458417+gregory-paidis-sonarsource@users.noreply.github.com>
2024-03-14 14:22:26 +01:00

14 lines
336 B
Plaintext

[source,csharp]
----
class EnclosingType
{
private readonly ILogger logger;
EnclosingType(ILoggerFactory loggerFactory)
{
logger = loggerFactory.CreateLogger("My cross-type logging category"); // Compliant
logger = loggerFactory.CreateLogger(AComplexLogicToFindTheRightType()); // Compliant
}
}
----