/// <summary> /// Writes the specified string /// </summary> /// <param name="value"></param> public override void Write(string value) { var message = new LogMessage() { LogDate = DateTime.Now, Message = value }; var handler = this.LogMessage; if (handler != null) { //Flush buffered messages foreach (var msg in _buffered) { handler(this, msg); } _buffered.Clear(); handler(this, message); } else { //Store in buffer _buffered.Add(message); } }
void OnLogMessage(object sender, LogMessage msg) { if (!txtMessages.IsDisposed) { txtMessages.AppendText(string.Format("[{0}]: {1}", msg.LogDate.ToString("dd MMM yyyy hh:mm:ss"), msg.Message)); //NOXLATE txtMessages.ScrollToCaret(); } }