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 LogChannel<TEvent> {
|
|
8 static LogChannel<TEvent> _default = new LogChannel<TEvent>();
|
|
9
|
|
10 public static LogChannel<TEvent> Default {
|
|
11 get {
|
|
12 return _default;
|
|
13 }
|
|
14 }
|
|
15
|
|
16 public event EventHandler<ValueEventArgs<TEvent>> Events;
|
|
17
|
|
18 public void LogEvent(TEvent data) {
|
|
19 var t = Events;
|
|
20 if (t!= null)
|
|
21 t(TraceContext.Current,new ValueEventArgs<TEvent>(data));
|
|
22 }
|
37
|
23
|
|
24 public void LogEvent(TraceContext context,TEvent data) {
|
|
25 var t = Events;
|
|
26 if (t != null)
|
|
27 t(context, new ValueEventArgs<TEvent>(data));
|
|
28 }
|
36
|
29 }
|
|
30 }
|