##// END OF EJS Templates
sync
sync

File last commit:

r92:4c0e5ef99986 v2
r103:b3f5bc613905 v2
Show More
ConsoleTraceListener.cs
34 lines | 941 B | text/x-csharp | CSharpLexer
/ Implab / Diagnostics / ConsoleTraceListener.cs
cin
improved log concept
r36 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Implab.Diagnostics {
cin
improved tracing...
r40 public class ConsoleTraceListener: TextListenerBase {
cin
improved log concept
r36
static readonly object _consoleLock = new object();
cin
improved tracing, TextListenerBase can be bound to logical operation scope.
r43 public ConsoleTraceListener()
: base(true) {
}
cin
Interactive tracing...
r48 public ConsoleTraceListener(bool global)
: base(global) {
cin
improved tracing, TextListenerBase can be bound to logical operation scope.
r43
}
cin
rewritten tracing
r92 protected override void WriteEntry(LogEventArgs args, EventText text, string channel) {
cin
improved tracing...
r40 var msg = new StringBuilder();
cin
improved log concept
r36
cin
improved tracing...
r40 for (int i = 0; i < text.indent; i++)
cin
improved log concept
r36 msg.Append(" ");
cin
rewritten tracing
r92 msg.AppendFormat("[{0}]:{1}: {2}", args.ThreadId, channel, text.content);
cin
improved log concept
r36
lock (_consoleLock) {
cin
rewritten tracing
r92 Console.ForegroundColor = (ConsoleColor)(args.ThreadId % 15 + 1);
Console.WriteLine(msg);
cin
improved log concept
r36 }
}
}
}