dotnet/runtime

Support nested logging classes in Logging Source Generator

eerhardt opened this issue · 1 comments

A common logging pattern is to put all the logging related methods in a nested class of the service that needs to log. However, the Logging Source Generator doesn't support this. When I try to do it, I get an error saying:

Severity	Code	Description	Project	File	Line	Suppression State
Error	SYSLIB1004	Logging class cannot be in nested types	Microsoft.Extensions.Diagnostics.HealthChecks	C:\git\aspnetcore\src\HealthChecks\HealthChecks\src\DefaultHealthCheckService.cs	201	

We should support this common coding pattern in the Logging Source Generator.

See discussion at dotnet/aspnetcore#32414 (comment)

cc @maryamariyan @davidfowl @shirhatti

Tagging subscribers to this area: @maryamariyan
See info in area-owners.md if you want to be subscribed.

Issue Details

A common logging pattern is to put all the logging related methods in a nested class of the service that needs to log. However, the Logging Source Generator doesn't support this. When I try to do it, I get an error saying:

Severity	Code	Description	Project	File	Line	Suppression State
Error	SYSLIB1004	Logging class cannot be in nested types	Microsoft.Extensions.Diagnostics.HealthChecks	C:\git\aspnetcore\src\HealthChecks\HealthChecks\src\DefaultHealthCheckService.cs	201	

We should support this common coding pattern in the Logging Source Generator.

See discussion at dotnet/aspnetcore#32414 (comment)

cc @maryamariyan @davidfowl @shirhatti

Author: eerhardt
Assignees: -
Labels:

area-Extensions-Logging

Milestone: -