private void UnsubscribeToEvents(IObservableLog observableLog) { if (observableLog != null) { observableLog.LogEvent -= OnLogEvent; } }
public FormattingLogObserver(IObservableLog observableLog, ILoggedItemFormatter loggedItemFormatter) { if (observableLog == null) { throw new ArgumentNullException("observableLog"); } if (loggedItemFormatter == null) { throw new ArgumentNullException("loggedItemFormatter"); } _observableLog = observableLog; _loggedItemFormatter = loggedItemFormatter; _observableLog.LogEvent += OnLogEvent; }
/// <summary> /// Adds an observed log to the hub /// </summary> /// <param name="observableLog"></param> public bool AddObservedLog(IObservableLog observableLog) { if (observableLog == null) { throw new ArgumentNullException("observableLog"); } if (!_observedLogs.Contains(observableLog)) { _observedLogs.Add(observableLog); SubscribeToEvents(observableLog); return true; } return false; }
/// <summary> /// Removes all observed logs from the hub /// </summary> /// <param name="observableLog"></param> /// <returns>true si l'élément a été enlevé</returns> public bool RemoveLogObserver(IObservableLog observableLog) { var removed = false; if (observableLog != null) { removed = _observedLogs.Remove(observableLog); if (removed) { UnsubscribeToEvents(observableLog); } } return removed; }
/// <summary> /// Removes all observed logs from the hub /// </summary> /// <param name="observableLog"></param> /// <returns>true si l'élément a été enlevé</returns> public bool RemoveLogObserver(IObservableLog observableLog) { var removed = false; if (observableLog != null) { removed = _observedLogs.Remove(observableLog); if (removed) { UnsubscribeToEvents(observableLog); } } return(removed); }
/// <summary> /// Adds an observed log to the hub /// </summary> /// <param name="observableLog"></param> public bool AddObservedLog(IObservableLog observableLog) { if (observableLog == null) { throw new ArgumentNullException("observableLog"); } if (!_observedLogs.Contains(observableLog)) { _observedLogs.Add(observableLog); SubscribeToEvents(observableLog); return(true); } return(false); }
public ToFileAsyncFormattingLogObserver(IObservableLog observableLog, ILoggedItemFormatter loggedItemFormatter) : base(observableLog, loggedItemFormatter) { }
public ToStringFormattingLogObserver(IObservableLog observableLog, ILoggedItemFormatter loggedItemFormatter) : base(observableLog, loggedItemFormatter) { }