Inheritance: System.EventArgs
コード例 #1
0
ファイル: Reporter.cs プロジェクト: dbremner/tiny
        private static void OnLogEventCaptured(LogItemEventArgs info)
        {
            // Cache the value because events are not thread safe.
            EventHandler <LogItemEventArgs> handler = LogEventCaptured;

            if (handler == null)
            {
                return;
            }

            try
            {
                handler(null, info);
            }
            catch (Exception e)
            {
                // If we are in the process of reporting an ReportError and we get
                // an exception, don't rethrow.  It's possible that one of the handlers
                // is in a terrible state.  Rethrowing might lead to an infinite loop.
                if (0 == String.CompareOrdinal(LogItemCategory.ReporterError, info.LogItem.Category))
                {
                    return;
                }

                LogItem info2 = new LogItem(
                    LogItemType.Error,
                    LogItemCategory.ReporterError,
                    "Error handling routine threw an exception during processing.",
                    e);
                Log(info2, e);
            }
        }
コード例 #2
0
ファイル: Reporter.cs プロジェクト: scottwis/tiny
        private static void OnLogEventCaptured(LogItemEventArgs info)
        {
            // Cache the value because events are not thread safe.
            EventHandler<LogItemEventArgs> handler = LogEventCaptured;
            if (handler == null)
            {
                return;
            }

            try
            {
                handler(null, info);
            }
            catch (Exception e)
            {
                // If we are in the process of reporting an ReportError and we get
                // an exception, don't rethrow.  It's possible that one of the handlers
                // is in a terrible state.  Rethrowing might lead to an infinite loop.
                if (0 == String.CompareOrdinal(LogItemCategory.ReporterError, info.LogItem.Category))
                {
                    return;
                }

                LogItem info2 = new LogItem(
                    LogItemType.Error,
                    LogItemCategory.ReporterError,
                    "Error handling routine threw an exception during processing.",
                    e);
                Log(info2, e);
            }
        }