##// END OF EJS Templates
Added class Trace<T> to manage channels for individual classes, if SomeClass...
Added class Trace<T> to manage channels for individual classes, if SomeClass uses Trace<SomeClass> it sould be marked with TraceSourceAttribute

File last commit:

r134:04d4c92d0f28 v2
r212:a01d9df88d74 v2
Show More
ConsoleTraceListener.cs
22 lines | 668 B | text/x-csharp | CSharpLexer
/ Implab / Diagnostics / ConsoleTraceListener.cs
cin
improved log concept
r36 using System;
using System.Text;
namespace Implab.Diagnostics {
cin
Improved logging
r134 public class ConsoleTraceListener: ListenerBase {
cin
improved log concept
r36
static readonly object _consoleLock = new object();
cin
Improved logging
r134 public override void Write(LogEventArgs args, object entry) {
cin
improved tracing...
r40 var msg = new StringBuilder();
cin
improved log concept
r36
cin
Improved logging
r134 for (int i = 0; i < args.Operation.Level; i++)
cin
improved log concept
r36 msg.Append(" ");
cin
Improved logging
r134 msg.AppendFormat("[{0}]: {1}", args.ThreadId, entry);
cin
improved log concept
r36
lock (_consoleLock) {
cin
sync
r133 Console.ForegroundColor = (ConsoleColor)(args.ThreadId % 15 + 1);
cin
rewritten tracing
r92 Console.WriteLine(msg);
cin
improved log concept
r36 }
}
}
}