示例#1
0
 public Exception AsVerbose(Exception exception, EventTraceActivity activity = null)
 {
     return(TraceException <Exception>(exception, TraceEventType.Verbose, activity));
 }
示例#2
0
 public Exception AsWarning(Exception exception, EventTraceActivity activity = null)
 {
     return(TraceException <Exception>(exception, TraceEventType.Warning, activity));
 }
示例#3
0
 public Exception AsInformation(Exception exception, EventTraceActivity activity = null)
 {
     return(TraceException <Exception>(exception, TraceEventType.Information, activity));
 }
示例#4
0
 public Exception AsError(Exception exception, EventTraceActivity activity = null)
 {
     return(TraceException <Exception>(exception, TraceEventType.Error, activity));
 }
示例#5
0
        public TException TraceException <TException>(TException exception, Microsoft.Azure.Devices.Client.TraceEventType level, EventTraceActivity activity = null)
#endif
            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:
#if !WINDOWS_UWP && !PCL
                    Trace.TraceError("An Exception is being thrown: {0}", GetDetailsForThrownException(exception));
#endif
                    ////if (MessagingClientEtwProvider.Provider.IsEnabled(
                    ////        EventLevel.Error,
                    ////        MessagingClientEventSource.Keywords.Client,
                    ////        MessagingClientEventSource.Channels.DebugChannel))
                    ////{
                    ////    MessagingClientEtwProvider.Provider.ThrowingExceptionError(activity, GetDetailsForThrownException(exception));
                    ////}

                    break;

                case TraceEventType.Warning:
#if !WINDOWS_UWP && !PCL
                    Trace.TraceWarning("An Exception is being thrown: {0}", GetDetailsForThrownException(exception));
#endif
                    ////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);
        }
示例#6
0
 public TException TraceException <TException>(TException exception, TraceEventType level, EventTraceActivity activity = null)