public Exception AsVerbose(Exception exception, EventTraceActivity activity = null) { return(TraceException <Exception>(exception, TraceEventType.Verbose, activity)); }
public Exception AsWarning(Exception exception, EventTraceActivity activity = null) { return(TraceException <Exception>(exception, TraceEventType.Warning, activity)); }
public Exception AsError(Exception exception, EventTraceActivity activity = null) { return(TraceException <Exception>(exception, TraceEventType.Error, activity)); }
public Exception AsInformation(Exception exception, EventTraceActivity activity = null) { return(TraceException <Exception>(exception, TraceEventType.Information, activity)); }
public TException TraceException <TException>(TException exception, TraceEventType level, EventTraceActivity activity = null) where TException : Exception { if (!exception.Data.Contains(this.eventSourceName)) { // Only trace if this is the first time an exception is thrown by this ExceptionTrace/EventSource. exception.Data[this.eventSourceName] = this.eventSourceName; switch (level) { case TraceEventType.Critical: case TraceEventType.Error: Trace.TraceError("An Exception is being thrown: {0}", GetDetailsForThrownException(exception)); ////if (MessagingClientEtwProvider.Provider.IsEnabled( //// EventLevel.Error, //// MessagingClientEventSource.Keywords.Client, //// MessagingClientEventSource.Channels.DebugChannel)) ////{ //// MessagingClientEtwProvider.Provider.ThrowingExceptionError(activity, GetDetailsForThrownException(exception)); ////} break; case TraceEventType.Warning: Trace.TraceWarning("An Exception is being thrown: {0}", GetDetailsForThrownException(exception)); ////if (MessagingClientEtwProvider.Provider.IsEnabled( //// EventLevel.Warning, //// MessagingClientEventSource.Keywords.Client, //// MessagingClientEventSource.Channels.DebugChannel)) ////{ //// MessagingClientEtwProvider.Provider.ThrowingExceptionWarning(activity, GetDetailsForThrownException(exception)); ////} break; default: #if DEBUG ////if (MessagingClientEtwProvider.Provider.IsEnabled( //// EventLevel.Verbose, //// MessagingClientEventSource.Keywords.Client, //// MessagingClientEventSource.Channels.DebugChannel)) ////{ //// MessagingClientEtwProvider.Provider.ThrowingExceptionVerbose(activity, GetDetailsForThrownException(exception)); ////} #endif break; } } BreakOnException(exception); return(exception); }