Skip to content

Cache reflection lookup for TransactionID in Net Core logs #100

@snakefoot

Description

@snakefoot

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();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions