No need to perform the reflection-dance for every LogEvent (Introduced with #94):
|
var traceContextProp = callContextType.GetProperty("TraceContext")?.GetValue(null); |
|
if (traceContextProp != null) |
|
{ |
|
var reqIdProp = traceCtxType.GetProperty("RequestId")?.GetValue(traceContextProp)?.ToString(); |
Should cache the lookup of callContextType.GetProperty("TraceContext") and traceCtxType.GetProperty("RequestId").
var traceContextProp = _callCtxTraceContextPropInfo.GetValue(null);
if (traceContextProp != null)
{
var reqIdProp = _traceCtxRequestIdPropInfo.GetValue(traceContextProp)?.ToString();
}