示例#1
0
        public void TraceHandledException(Exception exception, TraceEventType traceEventType)
        {
            switch (traceEventType)
            {
            case TraceEventType.Error:
                if (TraceCore.HandledExceptionErrorIsEnabled(this.diagnosticTrace))
                {
                    TraceCore.HandledExceptionError(this.diagnosticTrace, exception != null ? exception.ToString() : string.Empty, exception);
                }
                break;

            case TraceEventType.Warning:
                if (TraceCore.HandledExceptionWarningIsEnabled(this.diagnosticTrace))
                {
                    TraceCore.HandledExceptionWarning(this.diagnosticTrace, exception != null ? exception.ToString() : string.Empty, exception);
                }
                break;

            case TraceEventType.Verbose:
                if (TraceCore.HandledExceptionVerboseIsEnabled(this.diagnosticTrace))
                {
                    TraceCore.HandledExceptionVerbose(this.diagnosticTrace, exception != null ? exception.ToString() : string.Empty, exception);
                }
                break;

            default:
                if (TraceCore.HandledExceptionIsEnabled(this.diagnosticTrace))
                {
                    TraceCore.HandledException(this.diagnosticTrace, exception != null ? exception.ToString() : string.Empty, exception);
                }
                break;
            }
        }
示例#2
0
        public void TraceHandledException(Exception exception, TraceEventType traceEventType)
        {
            string         str;
            string         empty;
            string         str1;
            string         empty1;
            TraceEventType traceEventType1 = traceEventType;

            switch (traceEventType1)
            {
            case TraceEventType.Error:
            {
                if (!TraceCore.HandledExceptionErrorIsEnabled(this.diagnosticTrace))
                {
                    break;
                }
                EtwDiagnosticTrace etwDiagnosticTrace = this.diagnosticTrace;
                if (exception != null)
                {
                    str = exception.ToString();
                }
                else
                {
                    str = string.Empty;
                }
                TraceCore.HandledExceptionError(etwDiagnosticTrace, str, exception);
                return;
            }

            case TraceEventType.Critical | TraceEventType.Error:
            {
                if (!TraceCore.HandledExceptionIsEnabled(this.diagnosticTrace))
                {
                    break;
                }
                EtwDiagnosticTrace etwDiagnosticTrace1 = this.diagnosticTrace;
                if (exception != null)
                {
                    empty = exception.ToString();
                }
                else
                {
                    empty = string.Empty;
                }
                TraceCore.HandledException(etwDiagnosticTrace1, empty, exception);
                break;
            }

            case TraceEventType.Warning:
            {
                if (!TraceCore.HandledExceptionWarningIsEnabled(this.diagnosticTrace))
                {
                    break;
                }
                EtwDiagnosticTrace etwDiagnosticTrace2 = this.diagnosticTrace;
                if (exception != null)
                {
                    str1 = exception.ToString();
                }
                else
                {
                    str1 = string.Empty;
                }
                TraceCore.HandledExceptionWarning(etwDiagnosticTrace2, str1, exception);
                return;
            }

            default:
            {
                if (traceEventType1 == TraceEventType.Verbose)
                {
                    if (!TraceCore.HandledExceptionVerboseIsEnabled(this.diagnosticTrace))
                    {
                        break;
                    }
                    EtwDiagnosticTrace etwDiagnosticTrace3 = this.diagnosticTrace;
                    if (exception != null)
                    {
                        empty1 = exception.ToString();
                    }
                    else
                    {
                        empty1 = string.Empty;
                    }
                    TraceCore.HandledExceptionVerbose(etwDiagnosticTrace3, empty1, exception);
                    return;
                }
                else
                {
                    if (!TraceCore.HandledExceptionIsEnabled(this.diagnosticTrace))
                    {
                        break;
                    }
                    EtwDiagnosticTrace etwDiagnosticTrace1 = this.diagnosticTrace;
                    if (exception != null)
                    {
                        empty = exception.ToString();
                    }
                    else
                    {
                        empty = string.Empty;
                    }
                    TraceCore.HandledException(etwDiagnosticTrace1, empty, exception);
                    break;
                }
            }
            }
        }