5 // Marek Safar <marek.safar@gmail.com>
7 // Copyright (C) 2014 Xamarin Inc (http://www.xamarin.com)
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 namespace System.Diagnostics.Tracing
32 public class EventSource : IDisposable
34 protected EventSource ()
36 this.Name = this.GetType().Name;
39 protected EventSource (bool throwOnEventWriteErrors)
44 protected EventSource (EventSourceSettings settings)
47 this.Settings = settings;
50 protected EventSource (EventSourceSettings settings, params string[] traits)
55 public EventSource (string eventSourceName)
57 this.Name = eventSourceName;
60 public EventSource (string eventSourceName, EventSourceSettings config)
61 : this (eventSourceName)
63 this.Settings = config;
66 public EventSource (string eventSourceName, EventSourceSettings config, params string[] traits)
67 : this (eventSourceName, config)
71 public Exception ConstructionException
76 public static Guid CurrentThreadActivityId
78 get { return Guid.Empty; }
83 get { return Guid.Empty; }
92 public EventSourceSettings Settings
98 public bool IsEnabled ()
103 public bool IsEnabled (EventLevel level, EventKeywords keywords)
108 public bool IsEnabled (EventLevel level, EventKeywords keywords, EventChannel channel)
113 public void Dispose ()
118 public string GetTrait (string key)
123 public void Write (string eventName)
127 public void Write<T> (string eventName, T data)
131 public void Write<T> (string eventName, EventSourceOptions options, T data)
135 public void Write<T> (string eventName, ref EventSourceOptions options, ref T data)
139 public void Write<T> (string eventName, ref EventSourceOptions options, ref Guid activityId, ref Guid relatedActivityId, ref T data)
143 protected virtual void Dispose (bool disposing)
147 protected virtual void OnEventCommand (EventCommandEventArgs command)
151 protected void WriteEvent (int eventId)
155 protected void WriteEvent (int eventId, byte[] arg1)
159 protected void WriteEvent (int eventId, int arg1)
163 protected void WriteEvent (int eventId, string arg1)
167 protected void WriteEvent (int eventId, int arg1, int arg2)
171 protected void WriteEvent (int eventId, int arg1, int arg2, int arg3)
175 protected void WriteEvent (int eventId, int arg1, string arg2)
179 protected void WriteEvent (int eventId, long arg1)
183 protected void WriteEvent (int eventId, long arg1, byte[] arg2)
187 protected void WriteEvent (int eventId, long arg1, long arg2)
191 protected void WriteEvent (int eventId, long arg1, long arg2, long arg3)
195 protected void WriteEvent (int eventId, long arg1, string arg2)
199 protected void WriteEvent (int eventId, params object[] args)
203 protected void WriteEvent (int eventId, string arg1, int arg2)
207 protected void WriteEvent (int eventId, string arg1, int arg2, int arg3)
211 protected void WriteEvent (int eventId, string arg1, long arg2)
215 protected void WriteEvent (int eventId, string arg1, string arg2)
219 protected void WriteEvent (int eventId, string arg1, string arg2, string arg3)