I have created a log template to quickly add a static contextual logger at the top of my classes:
private static ILogger _logger = Log.ForContext<«Class»>();
Context: [InClass]
The problem is if I use it within a generic class it does not correctly substitute the class name, it excludes the generic part
e.g.
C#public class MyGenericClass<TInner>
{
private static ILogger _logger = Log.ForContext<MyGenericClass>();
}
when it should be
C#public class MyGenericClass<TInner>
{
private static ILogger _logger = Log.ForContext<MyGenericClass<TInner>>();
}
I've also tried «TypeName» with same result
I'm using VS2019 Enterprise 16.2
Hi,
Thank you for reaching out to us.
I managed to reproduce the described behavior and forwarded this thread to our R&D team for further research. We'll reply here once we have any results.