Created
February 27, 2019 05:33
-
-
Save nblumhardt/418ec93bbac79704ac3f8ed2684f70cb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Serilog.Core; | |
using Serilog.Events; | |
// .Enrich.With(new OperationIdEnricher()) | |
class OperationIdEnricher : ILogEventEnricher | |
{ | |
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory) | |
{ | |
if (logEvent.Properties.TryGetValue("RequestId", out var requestId)) | |
logEvent.AddPropertyIfAbsent(new LogEventProperty("operationId", requestId)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment