Skip to content

Instantly share code, notes, and snippets.

Avatar

Steffen Mads Lyng steffenlyng

  • Aarhus, Denmark
View GitHub Profile
@steffenlyng
steffenlyng / CorrelationIdEnricher.cs
Created Aug 11, 2015
Create Serilog Enricher to add Request header in logs
View CorrelationIdEnricher.cs
public class CorrelationIdEnricher : ILogEventEnricher
{
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
{
if (logEvent == null) throw new ArgumentNullException("logEvent");
if (HttpContext.Current == null)
return;
if (HttpContext.Current.Request == null)
You can’t perform that action at this time.