protected override Task <HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { var correlationId = _correlationIdAccessor.Get(); if (string.IsNullOrEmpty(correlationId)) { _logger.LogWarning($"No {CorrelationIdLogName} was found"); } else { request.Headers.Add(CorrelationIdHeader, correlationId); _logger.LogDebug($"Adding {CorrelationIdLogName} {correlationId} to headers"); } return(base.SendAsync(request, cancellationToken)); }
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory) { logEvent.AddPropertyIfAbsent(new LogEventProperty(CorrelationIdLogName, new ScalarValue(_correlationIdAccessor.Get()))); }