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