diff Implab/Diagnostics/LogChannel.cs @ 36:313f708a50e9 diagnostics

improved log concept
author cin
date Tue, 15 Apr 2014 02:00:09 +0400
parents
children c2c043520724
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Implab/Diagnostics/LogChannel.cs	Tue Apr 15 02:00:09 2014 +0400
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Implab.Diagnostics {
+    public class LogChannel<TEvent> {
+        static LogChannel<TEvent> _default = new LogChannel<TEvent>();
+
+        public static LogChannel<TEvent> Default {
+            get {
+                return _default;
+            }
+        }
+
+        public event EventHandler<ValueEventArgs<TEvent>> Events;
+
+        public void LogEvent(TEvent data) {
+            var t = Events;
+            if (t!= null)
+                t(TraceContext.Current,new ValueEventArgs<TEvent>(data));
+        }
+    }
+}