public override void Render(LogEvent @event, TextWriter writer, IFormatProvider formatProvider) { if (@event.Properties == null) { return; } if ([email protected](Name, out var value)) { return; } OperationContextValueFormatter.Format(@event, writer, value, Format, formatProvider); }
public static IHerculesTagsBuilder AddProperties( this IHerculesTagsBuilder builder, LogEvent @event, IReadOnlyCollection <string> filteredProperties, IFormatProvider formatProvider) { foreach (var keyValuePair in @event.Properties !) { var key = keyValuePair.Key; if (IsPositionalName(key)) { continue; } if (filteredProperties?.Contains(key) == true) { continue; } var value = keyValuePair.Value; if (key == WellKnownProperties.OperationContext && value is OperationContextValue operationContextValue) { value = operationContextValue.Select(t => OperationContextValueFormatter.Format(@event, t, null, formatProvider)).ToArray(); } if (builder.TryAddObject(key, value)) { continue; } var format = value is DateTime || value is DateTimeOffset ? "O" : null; builder.AddValue(key, ObjectValueFormatter.Format(value, format)); } return(builder); }