When TCategoryName
of ILogger<TCategoryName>
is a generic type
Then how do I include type name of the generic parameter type in the category name?
E.g.
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
class Foo<T> { }
using var services = new ServiceCollection()
.AddLogging(options => options.AddConsole())
.BuildServiceProvider();
var logger1 = services.GetRequiredService<ILogger<Foo<string>>>();
logger1.LogInformation("test"); //writes info: Foo[0], but I want Foo[System.String]