private Event GetEvent()

in src/Elastic.CommonSchema.NLog/EcsLayout.cs [514:543]


		private Event GetEvent(LogEventInfo logEventInfo)
		{
			var eventCategory = EventCategory?.Render(logEventInfo);
			var eventSeverity = EventSeverity?.Render(logEventInfo);
			var eventDurationMs = EventDurationMs?.Render(logEventInfo);
			var eventCode = EventCode?.Render(logEventInfo);
			if (string.IsNullOrEmpty(eventCode) || eventCode == "0")
				eventCode = null;
			var eventAction = EventAction?.Render(logEventInfo);
			var eventKind = EventKind?.Render(logEventInfo);

			var evnt = new Event
			{
				Created = logEventInfo.TimeStamp,
				Category = !string.IsNullOrEmpty(eventCategory) ? new[] { eventCategory } : null,
				Action = !string.IsNullOrEmpty(eventAction) ? eventAction : null,
				Id = EventId?.Render(logEventInfo),
				Code = eventCode,
				Kind = !string.IsNullOrEmpty(eventKind) ? eventKind : null,
				Severity = !string.IsNullOrEmpty(eventSeverity)
					? long.Parse(eventSeverity)
					: GetSysLogSeverity(logEventInfo.Level),
				Timezone = TimeZoneInfo.Local.StandardName,
			};

			if (!string.IsNullOrEmpty(eventDurationMs) && double.TryParse(eventDurationMs, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out var durationMs))
				evnt.Duration = (long)(durationMs * 1000000.0);   // milliseconds to nanoseconds

			return evnt;
		}