Mercurial > pub > ImplabNet
comparison Implab/Diagnostics/ConsoleTraceListener.cs @ 92:4c0e5ef99986 v2
rewritten tracing
author | cin |
---|---|
date | Wed, 22 Oct 2014 18:37:56 +0400 |
parents | d9d794b61bb9 |
children | 1b7ebcc52e5a |
comparison
equal
deleted
inserted
replaced
91:cdaaf4792c22 | 92:4c0e5ef99986 |
---|---|
16 public ConsoleTraceListener(bool global) | 16 public ConsoleTraceListener(bool global) |
17 : base(global) { | 17 : base(global) { |
18 | 18 |
19 } | 19 } |
20 | 20 |
21 protected override void WriteEntry(TraceContext context, EventText text, string channel) { | 21 protected override void WriteEntry(LogEventArgs args, 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}: {2}", context.ThreadId, channel, text.content); | 26 msg.AppendFormat("[{0}]:{1}: {2}", args.ThreadId, channel, text.content); |
27 | 27 |
28 lock (_consoleLock) { | 28 lock (_consoleLock) { |
29 Console.ForegroundColor = (ConsoleColor)(context.ThreadId % 15 + 1); | 29 Console.ForegroundColor = (ConsoleColor)(args.ThreadId % 15 + 1); |
30 Console.WriteLine(msg.ToString()); | 30 Console.WriteLine(msg); |
31 } | 31 } |
32 } | 32 } |
33 } | 33 } |
34 } | 34 } |