/// Represents a trace writer that writes to memory. When the trace message limit is
/// reached then old trace messages will be removed as new messages are added.
/// </summary>
publicclassMemoryTraceWriter:ITraceWriter
{
privatereadonlyQueue<string>_traceMessages;
privatereadonlyobject_lock;
/// <summary>
/// Gets the <see cref="TraceLevel"/> that will be used to filter the trace messages passed to the writer.
/// For example a filter level of <see cref="TraceLevel.Info"/> will exclude <see cref="TraceLevel.Verbose"/> messages and include <see cref="TraceLevel.Info"/>,
/// <see cref="TraceLevel.Warning"/> and <see cref="TraceLevel.Error"/> messages.
/// </summary>
/// <value>
/// The <see cref="TraceLevel"/> that will be used to filter the trace messages passed to the writer.
/// </value>
publicTraceLevelLevelFilter{get;set;}
/// <summary>
/// Initializes a new instance of the <see cref="MemoryTraceWriter"/> class.
/// </summary>
publicMemoryTraceWriter()
{
LevelFilter=TraceLevel.Verbose;
_traceMessages=newQueue<string>();
_lock=newobject();
}
/// <summary>
/// Writes the specified trace level, message and optional exception.
/// </summary>
/// <param name="level">The <see cref="TraceLevel"/> at which to write this trace.</param>