/// <summary> /// Subscribes to an <see cref="T:System.IObservable`1"/> using a <see cref="T:SemanticLogging.SignalR.SignalRSink"/>. /// /// </summary> /// <param name="eventStream">The event stream. Typically this is an instance of <see cref="T:Microsoft.Practices.EnterpriseLibrary.SemanticLogging.ObservableEventListener"/>.</param><param name="formatter">The formatter.</param><param name="colorMapper">The color mapper instance.</param> /// <returns> /// A subscription to the sink that can be disposed to unsubscribe the sink, or to get access to the sink instance. /// </returns> public static SinkSubscription <SignalRSink> LogToSignalR(this IObservable <EventEntry> eventStream, IEventTextFormatter formatter = null) { var sink = new SignalRSink(); formatter = formatter ?? new EventTextFormatter(); EnsureHostConfigured(sink); return(new SinkSubscription <SignalRSink>(EventEntryExtensions.SubscribeWithFormatter(eventStream, formatter, sink), sink)); }
private static void EnsureHostConfigured(SignalRSink sink) { sink.Startup(); }