Exemple #1
0
        /// <summary>
        /// Write an observable sequence of text to a specified log file.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="fileManager"></param>
        /// <returns></returns>
        public static IObservable <Unit> Write(IObservable <string> source, LogFileManager fileManager)
        {
            return(Observable.Create <Unit>((o) =>
            {
                var f = new FileLog(fileManager);

                // we need to initialize and then start writing...

                var sub = f.WriteObservable <string>(source).
                          Do(_ => o.OnNext(Unit.Default),
                             o.OnError,
                             o.OnCompleted).
                          Subscribe();

                return sub;
            }));
        }
Exemple #2
0
 public static IObservable <Unit> Write(this IObservable <string> source, LogFileManager fileManager)
 {
     return(FileLog.Write(source, fileManager));
 }
Exemple #3
0
 /// <summary>
 /// Create an instance using a specified <see cref="LogFileManager"/>
 /// </summary>
 /// <param name="fileManager"></param>
 public FileLog(LogFileManager fileManager)
 {
     _fileManager = fileManager;
 }