diff Implab/Diagnostics/ConsoleTraceListener.cs @ 192:f1da3afc3521 release v2.1

Слияние с v2
author cin
date Fri, 22 Apr 2016 13:10:34 +0300
parents 04d4c92d0f28
children
line wrap: on
line diff
--- a/Implab/Diagnostics/ConsoleTraceListener.cs	Wed Sep 03 18:34:02 2014 +0400
+++ b/Implab/Diagnostics/ConsoleTraceListener.cs	Fri Apr 22 13:10:34 2016 +0300
@@ -1,33 +1,21 @@
 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(TraceContext context, 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}: {2}", context.ThreadId, channel, text.content);
+            msg.AppendFormat("[{0}]: {1}", args.ThreadId, entry);
 
             lock (_consoleLock) {
-                Console.ForegroundColor = (ConsoleColor)(context.ThreadId % 15 + 1);
-                Console.WriteLine(msg.ToString());
+                Console.ForegroundColor = (ConsoleColor)(args.ThreadId % 15 + 1);
+                Console.WriteLine(msg);
             }
         }
     }