/// <summary>
 /// If the log is suppress
 /// </summary>
 /// <param name="logEvent">The appendding log</param>
 /// <returns>True:It is a suppress log and drop it. False:It is a available log.</returns>
 public bool isSuppressLog(LogEvent logEvent)
 {
     if (logEvent.MessageType == MessageType.LOG_SYSTEM && logEvent.Severity == Helper.Convert2Severity(Level.Error))
     {
         long currentTimestamp = Helper.GetTimestamp(DateTime.UtcNow);
         if (currentTimestamp - previousTimeStamp < suppressTimeoutSec * 1000)
         {
             return true;
         }
         else
         {
             previousTimeStamp = currentTimestamp;
             return false;
         }
     }
     return false;
 }
Beispiel #2
0
        /// <summary>
        /// Accept the log or not.
        /// </summary>
        /// <param name="capacity">The queue of log's capacity.</param>
        /// <param name="size">The current size of queue of log.</param>
        /// <param name="logEvent">The appenddin log</param>
        /// <returns>True:accept the log. False:drop the log</returns>
        public bool accept(int capacity, int size, LogEvent logEvent)
        {
            if (logEvent.MessageType == MessageType.LOG_SYSTEM)
            {
                //if this is system generated log message or state change request
                //always accept
                return true;
            }

            if (logEvent.Severity == Helper.Convert2Severity(Level.Error))
            {
                if (size < capacity + extraQueueSize)
                {
                    //if extra space is still able to accept this log item
                    return true;
                }
            }

            return false;
        }