コード例 #1
0
 /// <summary>
 ///     Constructs a new instance of the <see cref="IdentifiedTraceObserver{T}" /> class for tracing OnNext and OnError
 ///     calls.
 /// </summary>
 /// <param name="nextFormat">The format in which values will be traced.  A single replacement token {0} is supported.</param>
 /// <param name="errorFormat">The format in which the error will be traced.  A single replacement token {0} is supported.</param>
 public IdentifiedTraceObserver(string nextFormat, string errorFormat)
     : this(TraceDefaults.GetIdentityFormatOnNext <T>(nextFormat),
            TraceDefaults.GetIdentityFormatOnError(errorFormat))
 {
     Contract.Requires(nextFormat != null);
     Contract.Requires(errorFormat != null);
 }
コード例 #2
0
 /// <summary>
 /// Constructs a new instance of the <see cref="IdentifiedTraceObserver{T}"/> class for tracing OnNext, OnError and OnCompleted calls.
 /// </summary>
 /// <param name="nextFormat">The format in which values will be traced.  A single replacement token {0} is supported.</param>
 /// <param name="errorFormat">The format in which the error will be traced.  A single replacement token {0} is supported.</param>
 /// <param name="completedMessage">The message to be traced for the completed notification.</param>
 public IdentifiedTraceObserver(string nextFormat, string errorFormat, string completedMessage)
     : this(TraceDefaults.GetIdentityFormatOnNext <T>(nextFormat), TraceDefaults.GetIdentityFormatOnError(errorFormat), TraceDefaults.GetIdentityMessageOnCompleted(completedMessage))
 {
     Contract.Requires(nextFormat != null);
     Contract.Requires(errorFormat != null);
     Contract.Requires(completedMessage != null);
 }
コード例 #3
0
        /// <summary>
        /// Returns an observable that traces a call to OnError from the specified observable
        /// and includes an auto-generated identifier in the trace output.
        /// </summary>
        /// <typeparam name="T">The object that provides notification information.</typeparam>
        /// <param name="source">The observable from which the error will be traced.</param>
        /// <param name="format">The format in which the error will be traced.  A single replacement token {0} is supported.</param>
        /// <returns>An observable that traces a call to OnError.</returns>
        public static IObservable <T> TraceIdentityOnError <T>(this IObservable <T> source, string format)
        {
            Contract.Requires(source != null);
            Contract.Requires(format != null);
            Contract.Ensures(Contract.Result <IObservable <T> >() != null);

            return(source.Do(new IdentifiedTraceObserver <T>((a, b) => null, TraceDefaults.GetIdentityFormatOnError(format))));
        }
コード例 #4
0
        public static IEnumerable <T> TraceIdentityOnError <T>(this IEnumerable <T> source, TraceSource trace,
                                                               string format)
        {
            Contract.Requires(source != null);
            Contract.Requires(trace != null);
            Contract.Requires(format != null);
            Contract.Ensures(Contract.Result <IEnumerable <T> >() != null);

            var enumerable = source.Do(new IdentifiedTraceObserver <T>(trace, (a, b) => null,
                                                                       TraceDefaults.GetIdentityFormatOnError(format)));

            Contract.Assume(enumerable != null);

            return(enumerable);
        }