comparison Implab.Diagnostics.Interactive/InteractiveListener.cs @ 134:04d4c92d0f28 v2

Improved logging
author cin
date Wed, 11 Feb 2015 02:12:15 +0300
parents 671f60cd0250
children cbb0bd8fc0d1
comparison
equal deleted inserted replaced
133:6c49d02a9a05 134:04d4c92d0f28
7 using System.Threading.Tasks; 7 using System.Threading.Tasks;
8 using System.Windows.Forms; 8 using System.Windows.Forms;
9 9
10 namespace Implab.Diagnostics.Interactive 10 namespace Implab.Diagnostics.Interactive
11 { 11 {
12 public class InteractiveListener: TextListenerBase 12 public class InteractiveListener: ListenerBase
13 { 13 {
14 TraceForm m_form; 14 TraceForm m_form;
15 15
16 SynchronizationContext m_syncGuiThread; 16 SynchronizationContext m_syncGuiThread;
17 readonly Promise m_guiStarted = new Promise(); 17 readonly Promise m_guiStarted = new Promise();
27 27
28 readonly object m_pauseLock = new object(); 28 readonly object m_pauseLock = new object();
29 bool m_paused; 29 bool m_paused;
30 readonly ManualResetEvent m_pauseEvent = new ManualResetEvent(true); 30 readonly ManualResetEvent m_pauseEvent = new ManualResetEvent(true);
31 31
32 public InteractiveListener(bool global) : base(global) { 32 public InteractiveListener() {
33 m_guiFinished = AsyncPool.RunThread(GuiThread); 33 m_guiFinished = AsyncPool.RunThread(GuiThread);
34 /*m_workerFinished = */AsyncPool.RunThread(QueueThread); 34 /*m_workerFinished = */AsyncPool.RunThread(QueueThread);
35 35
36 m_guiStarted.Join(); 36 m_guiStarted.Join();
37 } 37 }
105 m_guiFinished.Join(); 105 m_guiFinished.Join();
106 } 106 }
107 base.Dispose(disposing); 107 base.Dispose(disposing);
108 } 108 }
109 109
110 protected override void WriteEntry(LogEventArgs args, EventText text, string channel) { 110 public override void Write(LogEventArgs args, object entry) {
111 var item = new TraceViewItem { 111 var item = new TraceViewItem {
112 Indent = text.indent, 112 Indent = args.Operation.Level,
113 Message = text.content, 113 Message = entry.ToString(),
114 Thread = args.ThreadId, 114 Thread = args.ThreadId,
115 Channel = channel, 115 Channel = args.ChannelName,
116 Timestamp = Environment.TickCount 116 Timestamp = Environment.TickCount
117 }; 117 };
118 118
119 Enqueue(item); 119 Enqueue(item);
120 } 120 }