comparison Implab/Diagnostics/Trace.cs @ 218:babe55c34931 v2

Trace logical operations in the correct channel
author cin
date Thu, 04 May 2017 02:17:53 +0300
parents a01d9df88d74
children 6f4630d0bcd9
comparison
equal deleted inserted replaced
217:6efb77590b15 218:babe55c34931
27 /// Starts the logical operation with the specified name, this name is usefull in logs. 27 /// Starts the logical operation with the specified name, this name is usefull in logs.
28 /// </summary> 28 /// </summary>
29 /// <param name="name">Name.</param> 29 /// <param name="name">Name.</param>
30 [Conditional("TRACE")] 30 [Conditional("TRACE")]
31 public static void StartLogicalOperation(string name) { 31 public static void StartLogicalOperation(string name) {
32 Channel.LogEvent(new TraceEvent(TraceContext.Instance.CurrentOperation, TraceEventType.OperationStarted, name));
32 TraceContext.Instance.StartLogicalOperation(name); 33 TraceContext.Instance.StartLogicalOperation(name);
33 } 34 }
34 35
35 /// <summary> 36 /// <summary>
36 /// Ends the logical operation and restores the previous one. 37 /// Ends the logical operation and restores the previous one.
37 /// </summary> 38 /// </summary>
38 [Conditional("TRACE")] 39 [Conditional("TRACE")]
39 public static void EndLogicalOperation() { 40 public static void EndLogicalOperation() {
40 var op = TraceContext.Instance.EndLogicalOperation(); 41 var op = TraceContext.Instance.EndLogicalOperation();
41 LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(op, TraceEventType.OperationCompleted, String.Format("-{0} : {1}ms", op.Name, op.Duration))); 42 Channel.LogEvent(new TraceEvent(op, TraceEventType.OperationCompleted, String.Format("-{0} : {1}ms", op.Name, op.Duration)));
42 } 43 }
43 44
44 /// <summary> 45 /// <summary>
45 /// Writes an informational message. 46 /// Writes an informational message.
46 /// </summary> 47 /// </summary>