/// <remarks>Do not call this from another thread. Yet.</remarks> public void AddMessage(LogType type, string message, params object[] inserts) { var m = new LogMessage { Type = type, Text = string.Format(CultureInfo.InvariantCulture, message, inserts), Time = DateTime.Now }; lock (syncObject) { Messages.Add(m); if (Messages.Count > MaxLength) Messages.RemoveRange(0, Messages.Count / 2); } RaiseMessageAdded(m); }
protected void RaiseMessageAdded(LogMessage m) { var f = MessageAdded; if (f != null) f(this, new LogEventArgs(m)); }
public LogEventArgs(LogMessage m) { Message = m; }