##// END OF EJS Templates
sync
sync

File last commit:

r134:04d4c92d0f28 v2
r168:8fb9c9507a26 ref20160224
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 }
}
}
}