public void InformationMessagesTest() { CreateForMessage((s) => Classified.Information(), LogLevel.Information, String.Empty); CreateForMessage(Classified.Information, LogLevel.Information, testMessage); CreateForMessageWithParams(Classified.Information, LogLevel.Information, formattedMessage, testParam); CreateForException(Classified.Information, LogLevel.Information, exception); CreateForExceptionWithAdditional(Classified.Information, LogLevel.Information, exception, testMessage); }
public static IObservable <TSource> Trace <TSource>(this IObservable <TSource> source, string name = default(string), [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int lineNo = 0) { Guard.NotNull(source); // counter used for our 'tick' occurance var id = 0; return(Observable.Create <TSource>(observer => { var id1 = ++id; var meta = new RxLogEntryMeta(typeof(ObservableExtensions), callerMemberName, lineNo); Action <string, object> trace = (m, v) => { try { RxLog.Log(meta, Classified.Information($"{name} {id1}: {m}({v})")); } catch (Exception) { // do nothing } }; trace("Subscribe", string.Empty); var subscription = source.Subscribe(v => { trace("OnNext", v); observer.OnNext(v); }, e => { trace("OnError", e.Message); observer.OnError(e); }, () => { trace("OnCompleted", ""); observer.OnCompleted(); }); return new CompositeDisposable(subscription, Disposable.Create(() => trace("Dispose", string.Empty))); })); }