comparison Implab/Diagnostics/TraceLog.cs @ 200:71e543dbe65a v2

working version of the project
author cin
date Fri, 14 Oct 2016 04:03:10 +0300
parents ea485487a424
children
comparison
equal deleted inserted replaced
199:43b1017ce100 200:71e543dbe65a
32 /// Ends the logical operation and restores the previous one. 32 /// Ends the logical operation and restores the previous one.
33 /// </summary> 33 /// </summary>
34 [Conditional("TRACE")] 34 [Conditional("TRACE")]
35 public static void EndLogicalOperation() { 35 public static void EndLogicalOperation() {
36 var op = TraceContext.Instance.EndLogicalOperation(); 36 var op = TraceContext.Instance.EndLogicalOperation();
37 LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(TraceEventType.OperationCompleted, String.Format("-{0} : {1}ms",op.Name, op.Duration))); 37 LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(op, TraceEventType.OperationCompleted, String.Format("-{0} : {1}ms",op.Name, op.Duration)));
38 } 38 }
39 39
40 /// <summary> 40 /// <summary>
41 /// Writes an informational message. 41 /// Writes an informational message.
42 /// </summary> 42 /// </summary>
43 /// <param name="format">Format.</param> 43 /// <param name="format">Format.</param>
44 /// <param name="arguments">Arguments.</param> 44 /// <param name="arguments">Arguments.</param>
45 [Conditional("TRACE")] 45 [Conditional("TRACE")]
46 public static void TraceInformation(string format, params object[] arguments) { 46 public static void TraceInformation(string format, params object[] arguments) {
47 LogChannel<TraceEvent>.Default.LogEvent(TraceEvent.Create(TraceEventType.Information, format, arguments)); 47 LogChannel<TraceEvent>.Default.LogEvent(TraceEvent.Create(TraceContext.Instance.CurrentOperation, TraceEventType.Information, format, arguments));
48 } 48 }
49 49
50 /// <summary> 50 /// <summary>
51 /// Writes a warning message. 51 /// Writes a warning message.
52 /// </summary> 52 /// </summary>
53 /// <param name="format">Format.</param> 53 /// <param name="format">Format.</param>
54 /// <param name="arguments">Arguments.</param> 54 /// <param name="arguments">Arguments.</param>
55 [Conditional("TRACE")] 55 [Conditional("TRACE")]
56 public static void TraceWarning(string format, params object[] arguments) { 56 public static void TraceWarning(string format, params object[] arguments) {
57 LogChannel<TraceEvent>.Default.LogEvent(TraceEvent.Create(TraceEventType.Warning, format, arguments)); 57 LogChannel<TraceEvent>.Default.LogEvent(TraceEvent.Create(TraceContext.Instance.CurrentOperation, TraceEventType.Warning, format, arguments));
58 } 58 }
59 59
60 [Conditional("TRACE")] 60 [Conditional("TRACE")]
61 public static void TraceError(string format, params object[] arguments) { 61 public static void TraceError(string format, params object[] arguments) {
62 LogChannel<TraceEvent>.Default.LogEvent(TraceEvent.Create(TraceEventType.Error, format, arguments)); 62 LogChannel<TraceEvent>.Default.LogEvent(TraceEvent.Create(TraceContext.Instance.CurrentOperation, TraceEventType.Error, format, arguments));
63 } 63 }
64 64
65 [Conditional("TRACE")] 65 [Conditional("TRACE")]
66 public static void TraceError(Exception err) { 66 public static void TraceError(Exception err) {
67 TraceError("{0}", err); 67 TraceError("{0}", err);