Mercurial > pub > ImplabNet
diff Implab/Diagnostics/TraceContext.cs @ 93:dc4942d09e74 v2
improved tracing
added the application components container MTComponentContainer.AppContainer
author | cin |
---|---|
date | Thu, 23 Oct 2014 01:13:57 +0400 |
parents | 4c0e5ef99986 |
children | a43745f81f10 |
line wrap: on
line diff
--- a/Implab/Diagnostics/TraceContext.cs Wed Oct 22 18:37:56 2014 +0400 +++ b/Implab/Diagnostics/TraceContext.cs Thu Oct 23 01:13:57 2014 +0400 @@ -41,35 +41,36 @@ } public void EnterLogicalOperation(LogicalOperation operation, bool takeOwnership) { - // TODO Emit event + LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(TraceEventType.Attach, String.Format("{0} -> [{1}]", operation.Name, m_threadId))); m_stack.Push(m_current); m_current = new OperationContext(operation, takeOwnership); } public void StartLogicalOperation(string name) { m_current.BeginLogicalOperation(name); + LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(TraceEventType.OperationStarted, String.Format("+{0}",CurrentOperation.Name))); } public void StartLogicalOperation() { - // TODO Emit Event - m_current.BeginLogicalOperation(String.Empty); + StartLogicalOperation(String.Empty); } public void EndLogicalOperation() { - // TODO Emit event + LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(TraceEventType.OperationCompleted, String.Format("-{0} : {1}ms",CurrentOperation.Name, CurrentOperation.Duration))); m_current.EndLogicalOperation(); } public LogicalOperation DetachLogicalOperation() { - // TODO Emit event - return m_current.DetachLogicalOperation(); + var op = m_current.DetachLogicalOperation(); + LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(TraceEventType.Detach, String.Format("[{0}] -> {1}", m_threadId, op.Name))); + return op; } public void Leave() { - // TODO Emit event - if (m_stack.Count > 0) + if (m_stack.Count > 0) { + m_current.Leave(); m_current = m_stack.Pop(); - else { + } else { TraceLog.TraceWarning("Attemtp to leave the last operation context"); m_current = OperationContext.EMPTY; }