Beispiel #1
0
		/// <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);
		}
Beispiel #2
0
		protected void RaiseMessageAdded(LogMessage m) {
			var f = MessageAdded;
			if (f != null)
				f(this, new LogEventArgs(m));
		}
Beispiel #3
0
		public LogEventArgs(LogMessage m) { Message = m; }