diff Implab/Diagnostics/TextListenerBase.cs @ 48:d9d794b61bb9 interactive logger

Interactive tracing Improved working with tracing contexts
author cin
date Fri, 18 Apr 2014 12:34:45 +0400
parents b181f7bcb259
children 4c0e5ef99986
line wrap: on
line diff
--- a/Implab/Diagnostics/TextListenerBase.cs	Thu Apr 17 18:49:36 2014 +0400
+++ b/Implab/Diagnostics/TextListenerBase.cs	Fri Apr 18 12:34:45 2014 +0400
@@ -10,9 +10,9 @@
         readonly LogicalOperation m_boundOperation;
         readonly int m_baseIndent;
 
-        protected TextListenerBase(bool local) {
+        protected TextListenerBase(bool global) {
             Register(this);
-            if (local) {
+            if (!global) {
                 m_boundOperation = TraceContext.Current.CurrentOperation;
                 m_baseIndent = Math.Max(0, m_boundOperation.Level - 1);
             }
@@ -36,6 +36,7 @@
                 AssertNotDisposed();
 
                 var formatter = GetService<IEventTextFormatter<TEvent>>();
+                var channelName = channel.Name;
 
                 EventHandler<ValueEventArgs<TEvent>> handler = (sender, args) => {
                     TraceContext context = (TraceContext)sender;
@@ -43,7 +44,7 @@
                     text.indent -= m_baseIndent;
 
                     if (IsRelated(context.CurrentOperation))
-                        WriteEntry(context, text);
+                        WriteEntry(context, text, channelName);
                 };
 
                 if (m_subscriptions.ContainsKey(channel))
@@ -98,7 +99,7 @@
         /// </remarks>
         /// <param name="context">Контекст трассировки.</param>
         /// <param name="text">Текст сообщения.</param>
-        protected abstract void WriteEntry(TraceContext context, EventText text);
+        protected abstract void WriteEntry(TraceContext context, EventText text, string channel);
         
         public EventText Format(TraceContext context, object data) {
             return new EventText {