using System; using System.Collections.Generic; using System.Text; namespace Bwg.Logging { /// /// This class is a message sink that forwards a message to a set of receiving sinks /// public class TeeSink : Sink { #region private member variables /// /// The list of sinks to send the message to /// IList m_sinks; #endregion #region constructor /// /// The constructor to creat the object /// public TeeSink() { m_sinks = new List(); } #endregion #region public methods /// /// Add the sink to the list of receiving sinks /// /// the sink to add public void AddSink(Sink s) { m_sinks.Add(s); } /// /// Remove the sink to the list of receiving sinks /// /// public void RemoveSink(Sink s) { m_sinks.Remove(s); } /// /// Log a message to the receiving sinks /// /// the message public override void LogMessage(UserMessage m) { foreach (Sink s in m_sinks) s.LogMessage(m); } #endregion } }