/// <summary> /// Constructs a new instance of the <see cref="TraceObserver{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 TraceObserver(string nextFormat, string errorFormat, string completedMessage) : this(TraceDefaults.GetFormatOnNext <T>(nextFormat), TraceDefaults.GetFormatOnError(errorFormat), TraceDefaults.GetMessageOnCompleted(completedMessage)) { Contract.Requires(nextFormat != null); Contract.Requires(errorFormat != null); Contract.Requires(completedMessage != null); }
public static IObservable <T> TraceOnNext <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 TraceObserver <T>(TraceDefaults.GetFormatOnNext <T>(format)))); }
public static IEnumerable <T> TraceOnNext <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 TraceObserver <T>(trace, TraceDefaults.GetFormatOnNext <T>(format))); Contract.Assume(enumerable != null); return(enumerable); }
/// <summary> /// Constructs a new instance of the <see cref="TraceObserver{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 TraceObserver(string nextFormat, string errorFormat) : this(TraceDefaults.GetFormatOnNext <T>(nextFormat), TraceDefaults.GetFormatOnError(errorFormat)) { Contract.Requires(nextFormat != null); Contract.Requires(errorFormat != null); }