Exemplo n.º 1
0
 /// <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;
 }
Exemplo n.º 2
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;
        }
Exemplo n.º 3
0
 /// <summary>
 /// Creates an event for an exception.
 /// </summary>
 public iEventObject Create(eEVENT_SEVERITY pSeverity, Exception pException)
 {
     return new EventObject(pSeverity, pException);
 }
Exemplo n.º 4
0
 /// <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);
 }
Exemplo n.º 5
0
 /// <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)
 {
 }