comparison Implab/Diagnostics/TraceEvent.cs @ 195:ea485487a424 v2

minor changes
author cin
date Wed, 04 May 2016 12:28:08 +0300
parents 6c49d02a9a05
children cc1baf7c8bd9
comparison
equal deleted inserted replaced
194:d45bdf510514 195:ea485487a424
10 public TraceEventType EventType { 10 public TraceEventType EventType {
11 get; 11 get;
12 private set; 12 private set;
13 } 13 }
14 14
15 public TraceEvent(TraceEventType type, string message) { 15 /// <summary>
16 /// The logical operation this event belongs to.
17 /// </summary>
18 public LogicalOperation Operation {
19 get;
20 private set;
21 }
22
23 /// <summary>
24 /// Gets the time offset in milliseconds from the start of the operation, if the operation is not specified the value is zero.
25 /// </summary>
26 public int OperationTime {
27 get;
28 private set;
29 }
30
31 public TraceEvent(LogicalOperation operation, TraceEventType type, string message) {
16 EventType = type; 32 EventType = type;
17 Message = message; 33 Message = message;
34 Operation = operation;
35 if (operation != null)
36 OperationTime = operation.Duration;
18 } 37 }
19 38
20 public override string ToString() { 39 public override string ToString() {
21 /*return EventType == TraceEventType.Information ? Message : String.Format("{0}: {1}", EventType, Message);*/
22 return Message; 40 return Message;
23 } 41 }
24 42
25 public static TraceEvent Create(TraceEventType type, string format, params object[] args) { 43 public static TraceEvent Create(LogicalOperation operation, TraceEventType type, string format, params object[] args) {
26 return new TraceEvent(type, format == null ? String.Empty : String.Format(format, args)); 44 return new TraceEvent(operation, type, format == null ? String.Empty : String.Format(format, args));
27 } 45 }
28 } 46 }
29 } 47 }