/// <summary> /// Initializes a new <see cref="DiagnosticEvent"/> /// </summary> /// <param name="source">The object that emitted the event</param> /// <param name="type">The type of event</param> /// <param name="detail">Specific details regarding this instance of the event</param> /// <param name="exception">The exception related to the event, if applicable</param> /// <param name="message">The message to which the event pertains, if applicable</param> /// <param name="endpoint">The name of the endpoint, if applicable</param> /// <param name="queue">The queue to which the event pertains, if applicable</param> /// <param name="topic">The topic to which the message pertains, if applicable</param> public DiagnosticEvent(object source, DiagnosticEventType type, string detail = null, Exception exception = null, Message message = null, EndpointName endpoint = null, QueueName queue = null, TopicName topic = null) { Timestamp = DateTime.UtcNow; Source = source; Type = type ?? throw new ArgumentNullException(nameof(type)); Detail = detail; Exception = exception; Message = message; Endpoint = endpoint; Queue = queue; Topic = topic; }
/// <summary> /// Determines whether another <paramref name="eventType"/> is equal to this one /// </summary> /// <param name="eventType">The other event type</param> /// <returns>Returns <c>true</c> if the other <paramref name="eventType"/> is equal /// to this one; <c>false</c> otherwise</returns> public bool Equals(DiagnosticEventType eventType) { return(!ReferenceEquals(null, eventType) && string.Equals(Name, eventType.Name, StringComparison.InvariantCultureIgnoreCase)); }
/// <summary> /// Initializes a new <see cref="DiagnosticEventBuilder"/> for the specified /// </summary> /// <param name="source">The object that will produce the event</param> /// <param name="type">The type of event</param> public DiagnosticEventBuilder(object source, DiagnosticEventType type) { Source = source; Type = type ?? throw new ArgumentNullException(nameof(type)); }