/// <summary> /// Initializes a new instance of the <see cref="ApplicationEvent" /> class. /// </summary> /// <param name="category"> /// The category of the event. /// </param> /// <param name="verbosity"> /// The verbosity level associated with the event. /// </param> /// <param name="description"> /// A textual description of the event. This argument can be <see langword="null" />. /// </param> /// <param name="environmentName"> /// The name of the environment on which the event originated, or <see langword="null" /> to indicate the current /// environment. /// </param> /// <param name="userInformation"> /// Information about a user whose action(s) caused the event. This argument can be <see langword="null" />. /// </param> /// <param name="occurrenceDateTime"> /// A <see cref="DateTime" /> that indicates when the event occurred. The default value is <see cref="DateTime.UtcNow" />. /// </param> /// <exception cref="ArgumentOutOfRangeException"> /// <paramref name="category" /> is equal to <see cref="ApplicationEventCategory.Unspecified" /> -or- /// <paramref name="verbosity" /> is equal to <see cref="ApplicationEventVerbosity.Unspecified" />. /// </exception> public ApplicationEvent(ApplicationEventCategory category, ApplicationEventVerbosity verbosity, String description, String environmentName, String userInformation, DateTime occurrenceDateTime) { Category = category.RejectIf().IsEqualToValue(ApplicationEventCategory.Unspecified, nameof(category)); Description = description; EnvironmentName = environmentName ?? CurrentEnvironmentName; OccurrenceDateTime = occurrenceDateTime; UserInformation = userInformation; Verbosity = verbosity.RejectIf().IsEqualToValue(ApplicationEventVerbosity.Unspecified, nameof(verbosity)); }
/// <summary> /// Initializes a new instance of the <see cref="ApplicationEvent" /> class. /// </summary> /// <param name="category"> /// The category of the event. /// </param> /// <param name="verbosity"> /// The verbosity level associated with the event. /// </param> /// <param name="description"> /// A textual description of the event. This argument can be <see langword="null" />. /// </param> /// <exception cref="ArgumentOutOfRangeException"> /// <paramref name="category" /> is equal to <see cref="ApplicationEventCategory.Unspecified" /> -or- /// <paramref name="verbosity" /> is equal to <see cref="ApplicationEventVerbosity.Unspecified" />. /// </exception> public ApplicationEvent(ApplicationEventCategory category, ApplicationEventVerbosity verbosity, String description) : this(category, verbosity, description, null) { return; }
/// <summary> /// Initializes a new instance of the <see cref="ApplicationEvent" /> class. /// </summary> /// <param name="category"> /// The category of the event. /// </param> /// <param name="verbosity"> /// The verbosity level associated with the event. /// </param> /// <exception cref="ArgumentOutOfRangeException"> /// <paramref name="category" /> is equal to <see cref="ApplicationEventCategory.Unspecified" /> -or- /// <paramref name="verbosity" /> is equal to <see cref="ApplicationEventVerbosity.Unspecified" />. /// </exception> public ApplicationEvent(ApplicationEventCategory category, ApplicationEventVerbosity verbosity) : this(category, verbosity, null) { return; }
/// <summary> /// Initializes a new instance of the <see cref="ApplicationEvent" /> class. /// </summary> /// <param name="category"> /// The category of the event. /// </param> /// <exception cref="ArgumentOutOfRangeException"> /// <paramref name="category" /> is equal to <see cref="ApplicationEventCategory.Unspecified" />. /// </exception> public ApplicationEvent(ApplicationEventCategory category) : this(category, DefaultVerbosity) { return; }
/// <summary> /// Initializes a new instance of the <see cref="ApplicationEvent" /> class. /// </summary> /// <param name="category"> /// The category of the event. /// </param> /// <param name="verbosity"> /// The verbosity level associated with the event. /// </param> /// <param name="description"> /// A textual description of the event. This argument can be <see langword="null" />. /// </param> /// <param name="environmentName"> /// The name of the environment on which the event originated, or <see langword="null" /> to indicate the current /// environment. /// </param> /// <param name="userInformation"> /// Information about a user whose action(s) caused the event. This argument can be <see langword="null" />. /// </param> /// <exception cref="ArgumentOutOfRangeException"> /// <paramref name="category" /> is equal to <see cref="ApplicationEventCategory.Unspecified" /> -or- /// <paramref name="verbosity" /> is equal to <see cref="ApplicationEventVerbosity.Unspecified" />. /// </exception> public ApplicationEvent(ApplicationEventCategory category, ApplicationEventVerbosity verbosity, String description, String environmentName, String userInformation) : this(category, verbosity, description, environmentName, userInformation, DateTime.UtcNow) { return; }
/// <summary> /// Initializes a new instance of the <see cref="ApplicationEvent" /> class. /// </summary> /// <param name="category"> /// The category of the event. /// </param> /// <param name="verbosity"> /// The verbosity level associated with the event. /// </param> /// <param name="description"> /// A textual description of the event. This argument can be <see langword="null" />. /// </param> /// <param name="environmentName"> /// The name of the environment on which the event originated, or <see langword="null" /> to indicate the current /// environment. /// </param> /// <exception cref="ArgumentOutOfRangeException"> /// <paramref name="category" /> is equal to <see cref="ApplicationEventCategory.Unspecified" /> -or- /// <paramref name="verbosity" /> is equal to <see cref="ApplicationEventVerbosity.Unspecified" />. /// </exception> public ApplicationEvent(ApplicationEventCategory category, ApplicationEventVerbosity verbosity, String description, String environmentName) : this(category, verbosity, description, environmentName, null) { return; }
/// <summary> /// Converts the current <see cref="ApplicationEventCategory" /> to an array of bytes. /// </summary> /// <param name="target"> /// The current instance of the <see cref="ApplicationEventCategory" />. /// </param> /// <returns> /// An array of bytes representing the current <see cref="ApplicationEventCategory" />. /// </returns> public static Byte[] ToByteArray(this ApplicationEventCategory target) => BitConverter.GetBytes((Int32)target);