Mercurial > pub > ImplabNet
annotate Implab/Diagnostics/TraceEvent.cs @ 108:f3bdb7ba59b9 v2
sync
author | cin |
---|---|
date | Tue, 11 Nov 2014 18:37:35 +0300 |
parents | dc4942d09e74 |
children | 6c49d02a9a05 |
rev | line source |
---|---|
36 | 1 using System; |
2 | |
3 namespace Implab.Diagnostics { | |
4 public class TraceEvent { | |
5 public string Message { | |
6 get; | |
7 private set; | |
8 } | |
9 | |
10 public TraceEventType EventType { | |
11 get; | |
12 private set; | |
13 } | |
14 | |
15 public TraceEvent(TraceEventType type, string message) { | |
16 EventType = type; | |
17 Message = message; | |
18 } | |
19 | |
40 | 20 public override string ToString() { |
93 | 21 return EventType == TraceEventType.Information ? Message : String.Format("{0}: {1}", EventType, Message); |
40 | 22 } |
23 | |
36 | 24 public static TraceEvent Create(TraceEventType type, string format, params object[] args) { |
43
7c2369f580b8
improved tracing, TextListenerBase can be bound to logical operation scope.
cin
parents:
42
diff
changeset
|
25 return new TraceEvent(type, format == null ? String.Empty : String.Format(format, args)); |
36 | 26 } |
27 } | |
28 } |