Merge branch 'master'
authorFrederik Carlier <frederik.carlier@quamotion.mobi>
Tue, 8 Mar 2016 18:41:40 +0000 (19:41 +0100)
committerFrederik Carlier <frederik.carlier@quamotion.mobi>
Tue, 8 Mar 2016 18:41:40 +0000 (19:41 +0100)
mcs/class/corlib/System.Diagnostics.Tracing/EventListener.cs [new file with mode: 0644]
mcs/class/corlib/System.Diagnostics.Tracing/EventSource.cs
mcs/class/corlib/System.Diagnostics.Tracing/EventWrittenEventArgs.cs [new file with mode: 0644]
mcs/class/corlib/corlib.dll.sources

diff --git a/mcs/class/corlib/System.Diagnostics.Tracing/EventListener.cs b/mcs/class/corlib/System.Diagnostics.Tracing/EventListener.cs
new file mode 100644 (file)
index 0000000..bc94435
--- /dev/null
@@ -0,0 +1,71 @@
+//
+// EventListener.cs
+//
+// Authors:
+//     Frederik Carlier  <frederik.carlier@quamotion.mobi>
+//
+// Copyright (C) 2015 Quamotion (http://quamotion.mobi)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Collections.Generic;
+
+namespace System.Diagnostics.Tracing
+{
+       public abstract class EventListener : IDisposable
+       {
+               protected EventListener ()
+               {
+               }
+
+               public static int EventSourceIndex(EventSource eventSource)
+               {
+                       return 0;
+               }
+
+               public void EnableEvents (EventSource eventSource, EventLevel level)
+               {
+               }
+
+               public void EnableEvents (EventSource eventSource, EventLevel level, EventKeywords matchAnyKeyword)
+               {
+               }
+
+               public void EnableEvents (EventSource eventSource, EventLevel level, EventKeywords matchAnyKeyword, IDictionary<string, string> arguments)
+               {
+               }
+
+               public void DisableEvents (EventSource eventSource)
+               {
+               }
+
+               protected internal virtual void OnEventSourceCreated (EventSource eventSource)
+               {
+               }
+
+               protected internal abstract void OnEventWritten (EventWrittenEventArgs eventData);
+
+               public virtual void Dispose()
+               {
+               }
+       }
+}
+
index 181eedff023051bba455a2f3462b63e1d498fa89..a67571aa9a62682b298878d44699cc4cc2479f9c 100644 (file)
@@ -3,8 +3,10 @@
 //
 // Authors:
 //     Marek Safar  <marek.safar@gmail.com>
+//     Frederik Carlier <frederik.carlier@quamotion.mobi>
 //
 // Copyright (C) 2014 Xamarin Inc (http://www.xamarin.com)
+// Copyrithg (C) 2015 Quamotion (http://quamotion.mobi)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -124,6 +126,7 @@ namespace System.Diagnostics.Tracing
                {
                }
 
+#if NET_4_6
                public void Write<T> (string eventName, T data)
                {
                }
@@ -139,6 +142,7 @@ namespace System.Diagnostics.Tracing
                public void Write<T> (string eventName, ref EventSourceOptions options, ref Guid activityId, ref Guid relatedActivityId, ref T data)
                {
                }
+#endif
 
                protected virtual void Dispose (bool disposing)
                {
@@ -150,50 +154,62 @@ namespace System.Diagnostics.Tracing
 
                protected void WriteEvent (int eventId)
                {
+                       WriteEvent (eventId, new object[] { } );
                }
 
                protected void WriteEvent (int eventId, byte[] arg1)
                {
+                       WriteEvent (eventId, new object[] { arg1 } );
                }
 
                protected void WriteEvent (int eventId, int arg1)
                {
+                       WriteEvent (eventId, new object[] { arg1 } );
                }
 
                protected void WriteEvent (int eventId, string arg1)
                {
+                       WriteEvent (eventId, new object[] { arg1 } );
                }
 
                protected void WriteEvent (int eventId, int arg1, int arg2)
                {
+                       WriteEvent (eventId, new object[] { arg1, arg2 } );
                }
 
                protected void WriteEvent (int eventId, int arg1, int arg2, int arg3)
                {
+                       WriteEvent (eventId, new object[] { arg1, arg2, arg3 } );
                }
 
                protected void WriteEvent (int eventId, int arg1, string arg2)
                {
+                       WriteEvent (eventId, new object[] { arg1, arg2 } );
                }
 
                protected void WriteEvent (int eventId, long arg1)
                {
+                       WriteEvent (eventId, new object[] { arg1 } );
                }
 
                protected void WriteEvent (int eventId, long arg1, byte[] arg2)
                {
+                       WriteEvent (eventId, new object[] { arg1, arg2 } );
                }
 
                protected void WriteEvent (int eventId, long arg1, long arg2)
                {
+                       WriteEvent (eventId, new object[] { arg1, arg2 } );
                }
 
                protected void WriteEvent (int eventId, long arg1, long arg2, long arg3)
                {
+                       WriteEvent (eventId, new object[] { arg1, arg2, arg3 } );
                }
 
                protected void WriteEvent (int eventId, long arg1, string arg2)
                {
+                       WriteEvent (eventId, new object[] { arg1, arg2 } );
                }
 
                protected void WriteEvent (int eventId, params object[] args)
@@ -202,22 +218,27 @@ namespace System.Diagnostics.Tracing
 
                protected void WriteEvent (int eventId, string arg1, int arg2)
                {
+                       WriteEvent (eventId, new object[] { arg1, arg2 } );
                }
 
                protected void WriteEvent (int eventId, string arg1, int arg2, int arg3)
                {
+                       WriteEvent (eventId, new object[] { arg1, arg2, arg3 } );
                }
 
                protected void WriteEvent (int eventId, string arg1, long arg2)
                {
+                       WriteEvent (eventId, new object[] { arg1, arg2 } );
                }
 
                protected void WriteEvent (int eventId, string arg1, string arg2)
                {
+                       WriteEvent (eventId, new object[] { arg1, arg2 } );
                }
 
                protected void WriteEvent (int eventId, string arg1, string arg2, string arg3)
                {
+                       WriteEvent (eventId, new object[] { arg1, arg2, arg3 } );
                }
        }
 }
diff --git a/mcs/class/corlib/System.Diagnostics.Tracing/EventWrittenEventArgs.cs b/mcs/class/corlib/System.Diagnostics.Tracing/EventWrittenEventArgs.cs
new file mode 100644 (file)
index 0000000..d9ddcbd
--- /dev/null
@@ -0,0 +1,124 @@
+//
+// EventWrittenEventArgs.cs
+//
+// Authors:
+//     Frederik Carlier  <frederik.carlier@quamotion.mobi>
+//
+// Copyright (C) 2015 Quamotion (http://quamotion.mobi)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+
+namespace System.Diagnostics.Tracing
+{
+       public class EventWrittenEventArgs : EventArgs
+       {
+               internal EventWrittenEventArgs (EventSource eventSource)
+               {
+                       this.EventSource = eventSource;
+               }
+
+               public Guid ActivityId
+               {
+                       get { return EventSource.CurrentThreadActivityId; }
+               }
+
+               public EventChannel Channel
+               {
+                       get { return EventChannel.None; }
+               }
+
+               public int EventId
+               {
+                       get;
+                       internal set;
+               }
+
+               public string EventName
+               {
+                       get;
+                       internal set;
+               }
+
+               public EventSource EventSource
+               {
+                       get;
+                       private set;
+               }
+
+               public EventKeywords Keywords
+               {
+                       get { return EventKeywords.None; }
+               }
+
+               public EventLevel Level
+               {
+                       get { return EventLevel.LogAlways; }
+               }
+
+               public string Message
+               {
+                       get;
+                       internal set;
+               }
+
+               public EventOpcode Opcode
+               {
+                       get { return EventOpcode.Info; }
+               }
+
+               public ReadOnlyCollection<object> Payload
+               {
+                       get;
+                       internal set;
+               }
+
+               public ReadOnlyCollection<string> PayloadNames
+               {
+                       get;
+                       internal set;
+               }
+
+               public Guid RelatedActivityId
+               {
+                       get;
+                       internal set;
+               }
+
+               public EventTags Tags
+               {
+                       get { return EventTags.None; }
+               }
+
+               public EventTask Task
+               {
+                       get { return EventTask.None; }
+               }
+
+               public byte Version
+               {
+                       get { return 0; }
+               }
+       }
+}
+
index 3cd521b6442f58a33681cd8f7597721d65a0d1ca..4d4fc1260a35fd80bb30dbe281bbe14538f33b6b 100644 (file)
@@ -166,6 +166,8 @@ System.Diagnostics.Tracing/EventSource.cs
 System.Diagnostics.Tracing/EventSourceAttribute.cs
 System.Diagnostics.Tracing/EventSourceSettings.cs
 System.Diagnostics.Tracing/EventCommandEventArgs.cs
+System.Diagnostics.Tracing/EventListener.cs
+System.Diagnostics.Tracing/EventWrittenEventArgs.cs
 System.Diagnostics.Tracing/NonEventAttribute.cs
 System.Diagnostics.SymbolStore/ISymbolBinder.cs
 System.Diagnostics.SymbolStore/ISymbolBinder1.cs