Auto status change to "Under Review"
@@ -1,47 +1,47 | |||
|
1 | 1 | using System; |
|
2 | 2 | |
|
3 | 3 | namespace Implab.Diagnostics { |
|
4 | 4 | public class TraceEvent { |
|
5 | 5 | public string Message { |
|
6 | 6 | get; |
|
7 | 7 | private set; |
|
8 | 8 | } |
|
9 | 9 | |
|
10 | 10 | public TraceEventType EventType { |
|
11 | 11 | get; |
|
12 | 12 | private set; |
|
13 | 13 | } |
|
14 | 14 | |
|
15 | 15 | /// <summary> |
|
16 | 16 | /// The logical operation this event belongs to. |
|
17 | 17 | /// </summary> |
|
18 | 18 | public LogicalOperation Operation { |
|
19 | 19 | get; |
|
20 | 20 | private set; |
|
21 | 21 | } |
|
22 | 22 | |
|
23 | 23 | /// <summary> |
|
24 | 24 | /// Gets the time offset in milliseconds from the start of the operation, if the operation is not specified the value is zero. |
|
25 | 25 | /// </summary> |
|
26 | 26 | public int OperationTime { |
|
27 | 27 | get; |
|
28 | 28 | private set; |
|
29 | 29 | } |
|
30 | 30 | |
|
31 | 31 | public TraceEvent(LogicalOperation operation, TraceEventType type, string message) { |
|
32 | 32 | EventType = type; |
|
33 | 33 | Message = message; |
|
34 | 34 | Operation = operation; |
|
35 | 35 | if (operation != null) |
|
36 | 36 | OperationTime = operation.Duration; |
|
37 | 37 | } |
|
38 | 38 | |
|
39 | 39 | public override string ToString() { |
|
40 | 40 | return Message; |
|
41 | 41 | } |
|
42 | 42 | |
|
43 | 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
ok, latest stable version should be in default
You need to be logged in to leave comments.
Login now