Skip to content

Instantly share code, notes, and snippets.

View madslyng's full-sized avatar
💭
🚜 Having fun in Big Agro 🌱

Mads Lyng madslyng

💭
🚜 Having fun in Big Agro 🌱
  • Aarhus, Denmark
View GitHub Profile
@madslyng
madslyng / CorrelationIdEnricher.cs
Created August 11, 2015 21:34
Create Serilog Enricher to add Request header in logs
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)