annotate Implab/Diagnostics/TraceEvent.cs @ 223:27ea7f07e2e4 default

Слияние
author cin
date Tue, 22 Aug 2017 09:35:54 +0300
parents 6c49d02a9a05
children ea485487a424
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
36
313f708a50e9 improved log concept
cin
parents:
diff changeset
1 using System;
313f708a50e9 improved log concept
cin
parents:
diff changeset
2
313f708a50e9 improved log concept
cin
parents:
diff changeset
3 namespace Implab.Diagnostics {
313f708a50e9 improved log concept
cin
parents:
diff changeset
4 public class TraceEvent {
313f708a50e9 improved log concept
cin
parents:
diff changeset
5 public string Message {
313f708a50e9 improved log concept
cin
parents:
diff changeset
6 get;
313f708a50e9 improved log concept
cin
parents:
diff changeset
7 private set;
313f708a50e9 improved log concept
cin
parents:
diff changeset
8 }
313f708a50e9 improved log concept
cin
parents:
diff changeset
9
313f708a50e9 improved log concept
cin
parents:
diff changeset
10 public TraceEventType EventType {
313f708a50e9 improved log concept
cin
parents:
diff changeset
11 get;
313f708a50e9 improved log concept
cin
parents:
diff changeset
12 private set;
313f708a50e9 improved log concept
cin
parents:
diff changeset
13 }
313f708a50e9 improved log concept
cin
parents:
diff changeset
14
313f708a50e9 improved log concept
cin
parents:
diff changeset
15 public TraceEvent(TraceEventType type, string message) {
313f708a50e9 improved log concept
cin
parents:
diff changeset
16 EventType = type;
313f708a50e9 improved log concept
cin
parents:
diff changeset
17 Message = message;
313f708a50e9 improved log concept
cin
parents:
diff changeset
18 }
313f708a50e9 improved log concept
cin
parents:
diff changeset
19
40
fe33f4e02ad5 improved tracing
cin
parents: 36
diff changeset
20 public override string ToString() {
133
cin
parents: 93
diff changeset
21 /*return EventType == TraceEventType.Information ? Message : String.Format("{0}: {1}", EventType, Message);*/
cin
parents: 93
diff changeset
22 return Message;
40
fe33f4e02ad5 improved tracing
cin
parents: 36
diff changeset
23 }
fe33f4e02ad5 improved tracing
cin
parents: 36
diff changeset
24
36
313f708a50e9 improved log concept
cin
parents:
diff changeset
25 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
26 return new TraceEvent(type, format == null ? String.Empty : String.Format(format, args));
36
313f708a50e9 improved log concept
cin
parents:
diff changeset
27 }
313f708a50e9 improved log concept
cin
parents:
diff changeset
28 }
313f708a50e9 improved log concept
cin
parents:
diff changeset
29 }