Mercurial > pub > ImplabNet
diff Implab/Diagnostics/ConsoleTraceListener.cs @ 134:04d4c92d0f28 v2
Improved logging
author | cin |
---|---|
date | Wed, 11 Feb 2015 02:12:15 +0300 |
parents | 6c49d02a9a05 |
children |
line wrap: on
line diff
--- a/Implab/Diagnostics/ConsoleTraceListener.cs Mon Feb 09 00:28:13 2015 +0300 +++ b/Implab/Diagnostics/ConsoleTraceListener.cs Wed Feb 11 02:12:15 2015 +0300 @@ -1,29 +1,17 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Text; namespace Implab.Diagnostics { - public class ConsoleTraceListener: TextListenerBase { + public class ConsoleTraceListener: ListenerBase { static readonly object _consoleLock = new object(); - public ConsoleTraceListener() - : base(true) { - - } - - public ConsoleTraceListener(bool global) - : base(global) { - - } - - protected override void WriteEntry(LogEventArgs args, EventText text, string channel) { + public override void Write(LogEventArgs args, object entry) { var msg = new StringBuilder(); - for (int i = 0; i < text.indent; i++) + for (int i = 0; i < args.Operation.Level; i++) msg.Append(" "); - msg.AppendFormat("[{0}]: {1}", args.ThreadId, text.content); + msg.AppendFormat("[{0}]: {1}", args.ThreadId, entry); lock (_consoleLock) { Console.ForegroundColor = (ConsoleColor)(args.ThreadId % 15 + 1);