/// <summary> /// Construct a new <seealso cref="LogEvent"/>. /// </summary> /// <param name="timestamp">The time at which the event occurred.</param> /// <param name="level">The level of the event.</param> /// <param name="exception">An exception associated with the event, or null.</param> /// <param name="messageTemplate">The message template describing the event.</param> /// <param name="properties">Properties associated with the event, including those presented in <paramref name="messageTemplate"/>.</param> public LogEvent(DateTimeOffset timestamp, LogEventLevel level, Exception exception, MessageTemplate messageTemplate, IEnumerable <LogEventProperty> properties) { if (messageTemplate == null) { throw new ArgumentNullException(nameof(messageTemplate)); } if (properties == null) { throw new ArgumentNullException(nameof(properties)); } Timestamp = timestamp; Level = level; Exception = exception; MessageTemplate = messageTemplate; _properties = new Dictionary <string, LogEventPropertyValue>(); foreach (var p in properties) { AddOrUpdateProperty(p); } }