private static MetadataDictionary GetMetadata()

in src/Elastic.CommonSchema.Serilog/LogEventConverter.cs [104:138]


		private static MetadataDictionary GetMetadata(LogEvent logEvent, ISet<string>? logEventPropertiesToFilter)
		{
			var dict = new MetadataDictionary { { "MessageTemplate", logEvent.MessageTemplate.Text } };

			//TODO what does this do and where does it come from?
			if (logEvent.Properties.TryGetValue("ActionPayload", out var actionPayload))
			{
				var logEventPropertyValues = (actionPayload as SequenceValue)?.Elements;

				if (logEventPropertyValues != null)
				{
					foreach (var item in logEventPropertyValues.Select(x => x.ToString()
									 .Replace("\"", string.Empty)
									 .Replace("[", string.Empty)
									 .Replace("]", string.Empty)
									 .Split(','))
								 .Select(value => new { Key = value[0].Trim(), Value = value[1].Trim() }))
						dict.Add(item.Key, item.Value);
				}
			}

			foreach (var logEventPropertyValue in logEvent.Properties)
			{
				if (PropertyAlreadyMapped(logEventPropertyValue.Key))
					continue;

				//key present in list of keys to filter
				if (logEventPropertiesToFilter?.Contains(logEventPropertyValue.Key) ?? false)
					continue;

				dict.Add(logEventPropertyValue.Key, PropertyValueToObject(logEventPropertyValue.Value));
			}

			return dict;
		}