/// <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 OnNext calls 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 notifications will be traced.</param>
        /// <param name="format">The format in which values will be traced.  A single replacement token {0} is supported.</param>
        /// <returns>An observable that traces OnNext notifications.</returns>
        public static IObservable <T> TraceIdentityOnNext <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>(TraceDefaults.GetIdentityFormatOnNext <T>(format))));
        }
Пример #4
0
        public static IEnumerable <T> TraceIdentityOnNext <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, TraceDefaults.GetIdentityFormatOnNext <T>(format)));

            Contract.Assume(enumerable != null);

            return(enumerable);
        }
 /// <summary>
 ///     Constructs a new instance of the <see cref="IdentifiedTraceObserver{T}" /> class for tracing OnNext calls.
 /// </summary>
 /// <param name="trace">The <see cref="TraceSource" /> to be associated with the trace messages.</param>
 /// <param name="nextFormat">The format in which values will be traced.  A single replacement token {0} is supported.</param>
 public IdentifiedTraceObserver(TraceSource trace, string nextFormat)
     : this(trace, TraceDefaults.GetIdentityFormatOnNext <T>(nextFormat))
 {
     Contract.Requires(trace != null);
     Contract.Requires(nextFormat != null);
 }