##// END OF EJS Templates
fixed trace
cin -
r219:cc1baf7c8bd9 v2
parent child
Show More
@@ -1,47 +1,47
1 using System;
1 using System;
2
2
3 namespace Implab.Diagnostics {
3 namespace Implab.Diagnostics {
4 public class TraceEvent {
4 public class TraceEvent {
5 public string Message {
5 public string Message {
6 get;
6 get;
7 private set;
7 private set;
8 }
8 }
9
9
10 public TraceEventType EventType {
10 public TraceEventType EventType {
11 get;
11 get;
12 private set;
12 private set;
13 }
13 }
14
14
15 /// <summary>
15 /// <summary>
16 /// The logical operation this event belongs to.
16 /// The logical operation this event belongs to.
17 /// </summary>
17 /// </summary>
18 public LogicalOperation Operation {
18 public LogicalOperation Operation {
19 get;
19 get;
20 private set;
20 private set;
21 }
21 }
22
22
23 /// <summary>
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.
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>
25 /// </summary>
26 public int OperationTime {
26 public int OperationTime {
27 get;
27 get;
28 private set;
28 private set;
29 }
29 }
30
30
31 public TraceEvent(LogicalOperation operation, TraceEventType type, string message) {
31 public TraceEvent(LogicalOperation operation, TraceEventType type, string message) {
32 EventType = type;
32 EventType = type;
33 Message = message;
33 Message = message;
34 Operation = operation;
34 Operation = operation;
35 if (operation != null)
35 if (operation != null)
36 OperationTime = operation.Duration;
36 OperationTime = operation.Duration;
37 }
37 }
38
38
39 public override string ToString() {
39 public override string ToString() {
40 return Message;
40 return Message;
41 }
41 }
42
42
43 public static TraceEvent Create(LogicalOperation operation, TraceEventType type, string format, params object[] args) {
43 public static TraceEvent Create(LogicalOperation operation, TraceEventType type, string format, params object[] args) {
44 return new TraceEvent(operation, type, format == null ? String.Empty : String.Format(format, args));
44 return new TraceEvent(operation, type, format == null ? String.Empty : args == null || args.Length == 0 ? format : String.Format(format, args));
45 }
45 }
46 }
46 }
47 }
47 }
General Comments 3
Under Review
author

Auto status change to "Under Review"

Approved
author

ok, latest stable version should be in default

You need to be logged in to leave comments. Login now