-
Notifications
You must be signed in to change notification settings - Fork 32
Closed
Labels
Description
NLog has Event Properties which is used for logging custom values.
LogEventInfo theEvent = new LogEventInfo(LogLevel.Debug, "", "Pass my custom value");
theEvent.Properties.Add("MyValue", "My custom string");
theEvent.Properties.Add("MyDateTimeValue", new DateTime(2015, 08, 30, 11, 26, 50));
logger.Log(theEvent);Currently the NLog target does not capture these values and it would be very nice if it could.
a naive fix would be adding something like below
if (loggingEvent.Properties.Any())
{
// capture properties of log event
loggingEvent
.Properties
.ToList()
.ForEach(prop => diags.Add(prop.Key.ToString(), prop.Value));
}after
stackify-api-dotnet/Src/NLog.Targets.Stackify/StackifyTarget.cs
Lines 296 to 301 in ed40f4c
| var diags = GetDiagnosticContextProperties(); | |
| if (diags != null && diags.ContainsKey("transid")) | |
| { | |
| msg.TransID = diags["transid"].ToString(); | |
| diags.Remove("transid"); | |
| } |