/// <summary> /// Writes the specified message to the internal queue of messages. /// </summary> /// <remarks> /// In order to avoid deadlocks, messages are put on an internal /// message queue. Accessing the queue does not require a context /// switch to the dispatcher that owns this listener (usu. the app /// dispatcher), so the application does not get blocked if two /// dispatcher treads are writing trace messages at the same time. /// </remarks> /// <param name="message">A message to write.</param> public override void Write(string message) { Debug.WriteLine(string.Format("SingleTraceListener.Write: {0}", message)); if (this.partialMessage == null) { this.partialMessage = new TraceMessage(message); this.queuedMessages.Enqueue(this.partialMessage); } else { this.partialMessage.AppendMessage(message); } }
/// <summary> /// Writes the specified message to the internal queue of messages. /// </summary> /// <remarks> /// In order to avoid deadlocks, messages are put on an internal /// message queue. Accessing the queue does not require a context /// switch to the dispatcher that owns this listener (usu. the app /// dispatcher), so the application does not get blocked if two /// dispatcher treads are writing trace messages at the same time. /// </remarks> /// <param name="message">A message to write.</param> public override void WriteLine(string message) { this.Write(message); this.partialMessage = null; }