using System.Text; namespace ExtremelySimpleLogger { /// /// A that writes output to a string, which can be queried using . /// Note that this uses a internally for performance. /// public class StringSink : Sink { private readonly StringBuilder builder = new StringBuilder(); /// /// The string that this sink currently contains. /// Can be cleared using . /// public string Value => this.builder.ToString(); /// /// Logs the given message, which has already been formatted using . /// /// The message to log public override void Log(string s) { this.builder.AppendLine(s); } /// /// Clears the string that this sink currently contains. /// After this call, will be empty. /// public void Clear() { this.builder.Clear(); } } }