Beispiel #1
0
        public void Add(ExceptionFormat exceptionFormat)
        {
            Exceptions.Add(exceptionFormat);

            if (Exceptions.Count > MaxExceptions)
            {
                Exceptions.RemoveRange(0, TrimExceptions);
            }
        }
Beispiel #2
0
        public static void LogException(Exception exception, bool logSilent = false, String extraDetails = "")
        {
            _logger = _GetInstance();
            if (_logger._isReadOnly)
            {
                return;
            }

            if (!_logger.HideErrors && !logSilent)
            {
                MessageBox.Show(exception.Message + "\n\n" + exception.StackTrace, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                _logger._errorsShown++;

                if (_logger._errorsShown >= AskLessThan)
                {
                    DialogResult dr = MessageBox.Show("Show further errors?", "Exception Messages", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

                    if (dr == DialogResult.Yes)
                    {
                        _logger._errorsShown = (1 << 31);
                    }
                    if (dr == DialogResult.No)
                    {
                        _logger.HideErrors = true;
                    }
                    if (dr == DialogResult.Cancel)
                    {
                        _logger._errorsShown = 0;
                    }
                }
            }

            ExceptionFormat exceptionFormat = new ExceptionFormat(exception, extraDetails);

            lock (Lock)
            {
                _logger._AddExceptionFormat(exceptionFormat);
                _logger._Serialize();
            }
        }
Beispiel #3
0
 private void _AddExceptionFormat(ExceptionFormat exceptionFormat)
 {
     _exceptionsLog.Add(exceptionFormat);
 }