Mercurial > pub > ImplabNet
diff Implab/Diagnostics/TraceContext.cs @ 134:04d4c92d0f28 v2
Improved logging
author | cin |
---|---|
date | Wed, 11 Feb 2015 02:12:15 +0300 |
parents | 6c49d02a9a05 |
children | ea485487a424 |
line wrap: on
line diff
--- a/Implab/Diagnostics/TraceContext.cs Mon Feb 09 00:28:13 2015 +0300 +++ b/Implab/Diagnostics/TraceContext.cs Wed Feb 11 02:12:15 2015 +0300 @@ -42,14 +42,14 @@ public void EnterLogicalOperation(LogicalOperation operation, bool takeOwnership) { //var prev = CurrentOperation; + //LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(takeOwnership ? TraceEventType.Attach : TraceEventType.Enter, String.Format("{0} -> {1}",prev.Name, operation.Name))); m_stack.Push(m_current); m_current = new OperationContext(operation, takeOwnership); - //LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(takeOwnership ? TraceEventType.Attach : TraceEventType.Enter, String.Format("{0} -> {1}",prev.Name, operation.Name))); } public void StartLogicalOperation(string name) { + LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(TraceEventType.OperationStarted, name)); m_current.BeginLogicalOperation(name); - LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(TraceEventType.OperationStarted, String.Format("+{0}",CurrentOperation.Name))); } public void StartLogicalOperation() { @@ -57,8 +57,8 @@ } public void EndLogicalOperation() { - LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(TraceEventType.OperationCompleted, String.Format("-{0} : {1}ms",CurrentOperation.Name, CurrentOperation.Duration))); - m_current.EndLogicalOperation(); + var op = m_current.EndLogicalOperation(); + LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(TraceEventType.OperationCompleted, String.Format("-{0} : {1}ms",op.Name, op.Duration))); } public LogicalOperation DetachLogicalOperation() {