AlarmWorkflow.Shared.Diagnostics.ExceptionIntervalLogger.ShouldLogException C# (CSharp) Метод

ShouldLogException() приватный Метод

private ShouldLogException ( Exception ex ) : bool
ex System.Exception
Результат bool
        private bool ShouldLogException(Exception ex)
        {
            if (_exceptionEntries.Any(e => e.Exception.StackTrace == ex.StackTrace) &&
                _exceptionEntries.Any(e => e.Exception.Message == ex.Message))
            {
                var exception = _exceptionEntries.Single(e => e.Exception.StackTrace == ex.StackTrace && e.Exception.Message == ex.Message);
                if (exception.LastLogTime.Add(_logInterval) > DateTime.UtcNow) return false;
                exception.LastLogTime = DateTime.UtcNow;
            }
            else
            {
                _exceptionEntries.Add(new TimedException(ex));
            }
            return true;
        }