-
-
Notifications
You must be signed in to change notification settings - Fork 94
Open
Labels
enhancement 💎New feature or requestNew feature or request
Description
Overview of the feature request
When the LoggerNameEnricher gets a generic type as context, it produces some pretty unreadable text - something like A.B.C.D.E.F.0.0.0, Culture=neutral, PublicKeyToken=null]]
I'd like to have something better readable
Motivation for or Use Case
I use generic classes that produce logs
Possible improvement
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
{
if (!logEvent.Properties.TryGetValue("SourceContext", out var context))
{
return;
}
string fullQualifiedClassName = context.ToString().Trim('"');
string fullQualifiedClassNameWithoutGenerics = Regex.Replace(fullQualifiedClassName,"`1\\[\\[.*\\]\\]","<?>");
logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty("LoggerName", GetAbbreviatedClassName(fullQualifiedClassNameWithoutGenerics, 39)));
}Related issues or PR
- [ x ] Checking this box is mandatory (this is just to show you read everything)
Metadata
Metadata
Assignees
Labels
enhancement 💎New feature or requestNew feature or request