Mercurial > pub > ImplabNet
comparison Implab/Diagnostics/TraceContext.cs @ 43:7c2369f580b8
improved tracing, TextListenerBase can be bound to logical operation scope.
author | cin |
---|---|
date | Wed, 16 Apr 2014 10:12:56 +0400 |
parents | 2fc0fbe7d58b |
children | d9d794b61bb9 |
comparison
equal
deleted
inserted
replaced
42:3ba6778ed336 | 43:7c2369f580b8 |
---|---|
90 var old = _current; | 90 var old = _current; |
91 Transfer(this); | 91 Transfer(this); |
92 try { | 92 try { |
93 action(); | 93 action(); |
94 } finally { | 94 } finally { |
95 _current.EndAllOperations(); | |
95 _current = old; | 96 _current = old; |
96 } | 97 } |
97 } | 98 } |
98 | 99 |
99 /// <summary> | 100 /// <summary> |
154 LogEvent(TraceEventType.OperationCompleted, "{0} {1} ms", op.Name, op.Duration); | 155 LogEvent(TraceEventType.OperationCompleted, "{0} {1} ms", op.Name, op.Duration); |
155 m_currentOperation = m_currentOperation.Parent; | 156 m_currentOperation = m_currentOperation.Parent; |
156 } | 157 } |
157 } | 158 } |
158 | 159 |
160 /// <summary> | |
161 /// Заврешает все начатые в этом контексте операции | |
162 /// </summary> | |
163 public void EndAllOperations() { | |
164 while (m_bound != m_currentOperation) | |
165 EndLogicalOperation(); | |
166 } | |
167 | |
159 void LogEvent(TraceEventType type, string format, params object[] args) { | 168 void LogEvent(TraceEventType type, string format, params object[] args) { |
160 LogChannel<TraceEvent>.Default.LogEvent(this, TraceEvent.Create(type, format, args)); | 169 LogChannel<TraceEvent>.Default.LogEvent(this, TraceEvent.Create(type, format, args)); |
161 } | 170 } |
162 } | 171 } |
163 } | 172 } |