Пример #1
0
 /// <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));
 }
Пример #2
0
 /// <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;
 }
Пример #3
0
 /// <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;
 }
Пример #4
0
 /// <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="ApplicationStartingMessage" /> class.
 /// </summary>
 /// <param name="applicationName">
 /// The name of the application that is starting.
 /// </param>
 /// <param name="verbosity">
 /// The verbosity level associated with the event. The default value is <see cref="ApplicationEventVerbosity.Normal" />.
 /// </param>
 /// <exception cref="ArgumentEmptyException">
 /// <paramref name="applicationName" /> is empty.
 /// </exception>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="applicationName" /> is <see langword="null" />.
 /// </exception>
 /// <exception cref="ArgumentOutOfRangeException">
 /// <paramref name="verbosity" /> is equal to <see cref="ApplicationEventVerbosity.Unspecified" />.
 /// </exception>
 public ApplicationStartingMessage(String applicationName, ApplicationEventVerbosity verbosity)
     : base(new ApplicationEvent(ApplicationEventCategory.ApplicationState, verbosity, $"{applicationName.RejectIf().IsNullOrEmpty(nameof(applicationName)).TargetArgument} is starting."))
 {
     return;
 }
Пример #6
0
 /// <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>
 /// Compose a reportable application event for the current <see cref="Exception" />.
 /// </summary>
 /// <param name="target">
 /// The current instance of the <see cref="Exception" />.
 /// </param>
 /// <param name="verbosity">
 /// The verbosity level associated with the event. The default value is <see cref="ApplicationEventVerbosity.Normal" />.
 /// </param>
 /// <param name="environmentName">
 /// The name of the environment on which the exception was raised, or <see langword="null" /> to indicate the current
 /// environment.
 /// </param>
 /// <returns>
 /// A reportable <see cref="ApplicationEvent" /> representing the current <see cref="Exception" />.
 /// </returns>
 /// <exception cref="ArgumentOutOfRangeException">
 /// <paramref name="verbosity" /> is equal to <see cref="ApplicationEventVerbosity.Unspecified" />.
 /// </exception>
 public static ApplicationEvent ComposeReportableEvent(this Exception target, ApplicationEventVerbosity verbosity, String environmentName) => target.ComposeReportableEvent(verbosity, environmentName, null);
 /// <summary>
 /// Compose a reportable application event for the current <see cref="Exception" />.
 /// </summary>
 /// <param name="target">
 /// The current instance of the <see cref="Exception" />.
 /// </param>
 /// <param name="verbosity">
 /// The verbosity level associated with the event. The default value is <see cref="ApplicationEventVerbosity.Normal" />.
 /// </param>
 /// <param name="environmentName">
 /// The name of the environment on which the exception was raised, or <see langword="null" /> to indicate the current
 /// environment.
 /// </param>
 /// <param name="userInformation">
 /// Information about a user whose action(s) caused the exception to be raised. This argument can be <see langword="null" />.
 /// </param>
 /// <returns>
 /// A reportable <see cref="ApplicationEvent" /> representing the current <see cref="Exception" />.
 /// </returns>
 /// <exception cref="ArgumentOutOfRangeException">
 /// <paramref name="verbosity" /> is equal to <see cref="ApplicationEventVerbosity.Unspecified" />.
 /// </exception>
 public static ApplicationEvent ComposeReportableEvent(this Exception target, ApplicationEventVerbosity verbosity, String environmentName, String userInformation) => target.ComposeReportableEvent(verbosity, environmentName, userInformation, DateTime.UtcNow);
 /// <summary>
 /// Compose a reportable application event for the current <see cref="Exception" />.
 /// </summary>
 /// <param name="target">
 /// The current instance of the <see cref="Exception" />.
 /// </param>
 /// <param name="verbosity">
 /// The verbosity level associated with the event. The default value is <see cref="ApplicationEventVerbosity.Normal" />.
 /// </param>
 /// <returns>
 /// A reportable <see cref="ApplicationEvent" /> representing the current <see cref="Exception" />.
 /// </returns>
 /// <exception cref="ArgumentOutOfRangeException">
 /// <paramref name="verbosity" /> is equal to <see cref="ApplicationEventVerbosity.Unspecified" />.
 /// </exception>
 public static ApplicationEvent ComposeReportableEvent(this Exception target, ApplicationEventVerbosity verbosity) => target.ComposeReportableEvent(verbosity, null);
 /// <summary>
 /// Compose a reportable application event for the current <see cref="Exception" />.
 /// </summary>
 /// <param name="target">
 /// The current instance of the <see cref="Exception" />.
 /// </param>
 /// <param name="verbosity">
 /// The verbosity level associated with the event. The default value is <see cref="ApplicationEventVerbosity.Normal" />.
 /// </param>
 /// <param name="environmentName">
 /// The name of the environment on which the exception was raised, or <see langword="null" /> to indicate the current
 /// environment.
 /// </param>
 /// <param name="userInformation">
 /// Information about a user whose action(s) caused the exception to be raised. This argument can be <see langword="null" />.
 /// </param>
 /// <param name="occurrenceDateTime">
 /// A <see cref="DateTime" /> that indicates when the exception was raised. The default value is
 /// <see cref="DateTime.UtcNow" />.
 /// </param>
 /// <returns>
 /// A reportable <see cref="ApplicationEvent" /> representing the current <see cref="Exception" />.
 /// </returns>
 /// <exception cref="ArgumentOutOfRangeException">
 /// <paramref name="verbosity" /> is equal to <see cref="ApplicationEventVerbosity.Unspecified" />.
 /// </exception>
 public static ApplicationEvent ComposeReportableEvent(this Exception target, ApplicationEventVerbosity verbosity, String environmentName, String userInformation, DateTime occurrenceDateTime) => new ApplicationEvent(ApplicationEventCategory.Error, verbosity, $"{target.Message} {target.StackTrace}", environmentName, userInformation, occurrenceDateTime);
Пример #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ExceptionRaisedMessage" /> class.
 /// </summary>
 /// <param name="exception">
 /// An object representing the reportable event.
 /// </param>
 /// <param name="verbosity">
 /// The verbosity level associated with the event. The default value is <see cref="ApplicationEventVerbosity.Normal" />.
 /// </param>
 /// <param name="correlationIdentifier">
 /// A unique identifier that is assigned to related messages.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="exception" /> is <see langword="null" />.
 /// </exception>
 /// <exception cref="ArgumentOutOfRangeException">
 /// <paramref name="verbosity" /> is equal to <see cref="ApplicationEventVerbosity.Unspecified" /> -or-
 /// <paramref name="correlationIdentifier" /> is equal to <see cref="Guid.Empty" />.
 /// </exception>
 public ExceptionRaisedMessage(Exception exception, ApplicationEventVerbosity verbosity, Guid correlationIdentifier)
     : this(exception, verbosity, correlationIdentifier, Guid.NewGuid())
 {
     return;
 }
Пример #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ExceptionRaisedMessage" /> class.
 /// </summary>
 /// <param name="exception">
 /// An object representing the reportable event.
 /// </param>
 /// <param name="verbosity">
 /// The verbosity level associated with the event. The default value is <see cref="ApplicationEventVerbosity.Normal" />.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="exception" /> is <see langword="null" />.
 /// </exception>
 /// <exception cref="ArgumentOutOfRangeException">
 /// <paramref name="verbosity" /> is equal to <see cref="ApplicationEventVerbosity.Unspecified" />.
 /// </exception>
 public ExceptionRaisedMessage(Exception exception, ApplicationEventVerbosity verbosity)
     : this(exception, verbosity, Guid.NewGuid())
 {
     return;
 }
Пример #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ExceptionRaisedMessage" /> class.
 /// </summary>
 /// <param name="exception">
 /// An object representing the reportable event.
 /// </param>
 /// <param name="verbosity">
 /// The verbosity level associated with the event. The default value is <see cref="ApplicationEventVerbosity.Normal" />.
 /// </param>
 /// <param name="correlationIdentifier">
 /// A unique identifier that is assigned to related messages.
 /// </param>
 /// <param name="identifier">
 /// A unique identifier for the message.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="exception" /> is <see langword="null" />.
 /// </exception>
 /// <exception cref="ArgumentOutOfRangeException">
 /// <paramref name="verbosity" /> is equal to <see cref="ApplicationEventVerbosity.Unspecified" /> -or-
 /// <paramref name="correlationIdentifier" /> is equal to <see cref="Guid.Empty" /> -or- <paramref name="identifier" /> is
 /// equal to <see cref="Guid.Empty" />.
 /// </exception>
 public ExceptionRaisedMessage(Exception exception, ApplicationEventVerbosity verbosity, Guid correlationIdentifier, Guid identifier)
     : base(exception.RejectIf().IsNull(nameof(exception)).TargetArgument.ComposeReportableEvent(verbosity), correlationIdentifier, identifier)
 {
     return;
 }