示例#1
0
        public void TraceEtwException(Exception exception, TraceEventType eventType)
        {
            switch (eventType)
            {
            case TraceEventType.Error:
            case TraceEventType.Warning:
                if (TraceCore.ThrowingEtwExceptionIsEnabled(this.diagnosticTrace))
                {
                    TraceCore.ThrowingEtwException(this.diagnosticTrace, this.eventSourceName, exception != null ? exception.ToString() : string.Empty, exception);
                }
                break;

            case TraceEventType.Critical:
                if (TraceCore.EtwUnhandledExceptionIsEnabled(this.diagnosticTrace))
                {
                    TraceCore.EtwUnhandledException(this.diagnosticTrace, exception != null ? exception.ToString() : string.Empty, exception);
                }
                break;

            default:
                if (TraceCore.ThrowingEtwExceptionVerboseIsEnabled(this.diagnosticTrace))
                {
                    TraceCore.ThrowingEtwExceptionVerbose(this.diagnosticTrace, this.eventSourceName, exception != null ? exception.ToString() : string.Empty, exception);
                }
                break;
            }
        }