/// <summary> /// Raises the <see cref="Log"/> event on this instance. /// </summary> /// <param name="eventType">The event type to raise.</param> /// <param name="ex">The exception to raise the event for, if applicable.</param> /// <param name="format">The message format to use.</param> /// <param name="args">The message format arguments.</param> private void RaiseLog(EventLoggerEventType eventType, Exception ex, string format, params object[] args) { if (this.Log != null) { string message = null; if (!string.IsNullOrEmpty(format)) { message = string.Format(CultureInfo.InvariantCulture, format, args); } this.Log(this, new EventLoggerEventArgs(eventType, message, ex)); } }
/// <summary> /// Initializes a new instance of the EventLoggerEventArgs class. /// </summary> /// <param name="eventType">The event type.</param> /// <param name="message">The event message.</param> /// <param name="ex">The event exception.</param> public EventLoggerEventArgs(EventLoggerEventType eventType, string message, Exception ex) { this.EventType = eventType; this.Message = message ?? string.Empty; this.Exception = ex; }
/// <summary> /// Initializes a new instance of the EventLoggerEventArgs class. /// </summary> /// <param name="eventType">The event type.</param> /// <param name="message">The event message.</param> public EventLoggerEventArgs(EventLoggerEventType eventType, string message) : this(eventType, message, null) { }
/// <summary> /// Raises the <see cref="Log"/> event on this instance. /// </summary> /// <param name="eventType">The event type to raise.</param> /// <param name="ex">The exception to raise the event for, if applicable.</param> /// <param name="format">The message format to use.</param> /// <param name="args">The message format arguments.</param> private void RaiseLog(EventLoggerEventType eventType, Exception ex, string format, params object[] args) { if (this.Log != null) { string message = null; if (!string.IsNullOrEmpty(format)) { message = string.Format(CultureInfo.InvariantCulture, format, args); } this.Log(this, new EventLoggerEventArgs(eventType, message, ex)); } }
/// <summary> /// Initializes a new instance of the EventLoggerEventArgs class. /// </summary> /// <param name="eventType">The event type.</param> /// <param name="message">The event message.</param> /// <param name="ex">The event exception.</param> public EventLoggerEventArgs(EventLoggerEventType eventType, string message, Exception ex) { this.EventType = eventType; this.Message = message ?? string.Empty; this.Exception = ex; }
/// <summary> /// Initializes a new instance of the EventLoggerEventArgs class. /// </summary> /// <param name="eventType">The event type.</param> /// <param name="message">The event message.</param> public EventLoggerEventArgs(EventLoggerEventType eventType, string message) : this(eventType, message, null) { }