/// <summary> /// Counts how many events in total have occurred by type. /// </summary> public int getCount(eEVENT_SEVERITY pSeverity) { lock (_counters) { if (_counters.ContainsKey(pSeverity)) { return _counters[pSeverity]; } } return 0; }
/// <summary> /// Constructor /// </summary> /// <param name="pSeverity">Severity of the error.</param> /// <param name="pType">The type of error.</param> /// <param name="pDesc">The description</param> /// <param name="pMessage">The lengthy message.</param> public EventObject(eEVENT_SEVERITY pSeverity, string pType, string pDesc, string pMessage) { if (pType == null) { throw new ArgumentNullException("pType"); } if (pDesc == null) { throw new ArgumentNullException("pDesc"); } if (pMessage == null) { throw new ArgumentNullException("pMessage"); } ID = Guid.NewGuid(); Severity = pSeverity; When = DateTime.Now; Type = pType; Desc = pDesc; Message = pMessage; }
/// <summary> /// Creates an event for an exception. /// </summary> public iEventObject Create(eEVENT_SEVERITY pSeverity, Exception pException) { return new EventObject(pSeverity, pException); }
/// <summary> /// Creates an event object. /// </summary> public iEventObject Create(eEVENT_SEVERITY pSeverity, string pType, string pDesc, string pMessage) { return new EventObject(pSeverity, pType, pDesc, pMessage); }
/// <summary> /// Constructor /// </summary> /// <param name="pSeverity">Severity of the error.</param> /// <param name="pWhat">The error to remember.</param> public EventObject(eEVENT_SEVERITY pSeverity, Exception pWhat) : this(pSeverity, pWhat.GetType().Name, pWhat.Message, pWhat.StackTrace ?? pWhat.Message) { }