comparison Implab/Diagnostics/ConsoleTraceListener.cs @ 50:f8cbe84cfdb1

Слияние с interactive logger
author cin
date Fri, 18 Apr 2014 12:37:48 +0400
parents d9d794b61bb9
children 4c0e5ef99986
comparison
equal deleted inserted replaced
44:e5ec543feee3 50:f8cbe84cfdb1
11 public ConsoleTraceListener() 11 public ConsoleTraceListener()
12 : base(true) { 12 : base(true) {
13 13
14 } 14 }
15 15
16 public ConsoleTraceListener(bool local) 16 public ConsoleTraceListener(bool global)
17 : base(local) { 17 : base(global) {
18 18
19 } 19 }
20 20
21 protected override void WriteEntry(TraceContext context, EventText text) { 21 protected override void WriteEntry(TraceContext context, EventText text, string channel) {
22 var msg = new StringBuilder(); 22 var msg = new StringBuilder();
23 23
24 for (int i = 0; i < text.indent; i++) 24 for (int i = 0; i < text.indent; i++)
25 msg.Append(" "); 25 msg.Append(" ");
26 msg.AppendFormat("[{0}]: {1}", context.ThreadId, text.content); 26 msg.AppendFormat("[{0}]:{1}: {2}", context.ThreadId, channel, text.content);
27 27
28 lock (_consoleLock) { 28 lock (_consoleLock) {
29 Console.ForegroundColor = (ConsoleColor)(context.ThreadId % 15 + 1); 29 Console.ForegroundColor = (ConsoleColor)(context.ThreadId % 15 + 1);
30 Console.WriteLine(msg.ToString()); 30 Console.WriteLine(msg.ToString());
31 } 31 }