Mercurial > pub > ImplabNet
annotate Implab/Diagnostics/TraceEvent.cs @ 52:edf0bc558596
improved trace system
author | cin |
---|---|
date | Mon, 05 May 2014 07:35:48 +0400 |
parents | 7c2369f580b8 |
children | dc4942d09e74 |
rev | line source |
---|---|
36 | 1 using System; |
2 using System.Collections.Generic; | |
3 using System.Linq; | |
4 using System.Text; | |
5 | |
6 namespace Implab.Diagnostics { | |
7 public class TraceEvent { | |
8 public string Message { | |
9 get; | |
10 private set; | |
11 } | |
12 | |
13 public TraceEventType EventType { | |
14 get; | |
15 private set; | |
16 } | |
17 | |
18 public TraceEvent(TraceEventType type, string message) { | |
19 EventType = type; | |
20 Message = message; | |
21 } | |
22 | |
40 | 23 public override string ToString() { |
52 | 24 if (EventType == TraceEventType.Information) |
25 return Message; | |
26 else | |
27 return String.Format("{0}: {1}", EventType, Message); | |
40 | 28 } |
29 | |
36 | 30 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
|
31 return new TraceEvent(type, format == null ? String.Empty : String.Format(format, args)); |
36 | 32 } |
33 } | |
34 } |