Merge pull request #1896 from meum/patch-1
[mono.git] / mcs / class / corlib / System.Diagnostics.Tracing / EventSource.cs
1 //
2 // EventSource.cs
3 //
4 // Authors:
5 //      Marek Safar  <marek.safar@gmail.com>
6 //
7 // Copyright (C) 2014 Xamarin Inc (http://www.xamarin.com)
8 //
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:
16 //
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 //
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.
27 //
28
29
30 namespace System.Diagnostics.Tracing
31 {
32         public class EventSource : IDisposable
33         {
34                 protected EventSource ()
35                 {
36                         this.Name = this.GetType().Name;
37                 }
38
39                 protected EventSource (bool throwOnEventWriteErrors)
40                         : this ()
41                 {
42                 }
43
44                 protected EventSource (EventSourceSettings settings)
45                         : this ()
46                 {
47                         this.Settings = settings;
48                 }
49
50                 protected EventSource (EventSourceSettings settings, params string[] traits)
51                         : this (settings)
52                 {
53                 }
54
55                 public EventSource (string eventSourceName)
56                 {
57                         this.Name = eventSourceName;
58                 }
59
60                 public EventSource (string eventSourceName, EventSourceSettings config)
61                         : this (eventSourceName)
62                 {
63                         this.Settings = config;
64                 }
65
66                 public EventSource (string eventSourceName, EventSourceSettings config, params string[] traits)
67                         : this (eventSourceName, config)
68                 {
69                 }
70
71                 public Exception ConstructionException
72                 {
73                         get { return null; }
74                 }
75
76                 public static Guid CurrentThreadActivityId
77                 {
78                         get { return Guid.Empty; }
79                 }
80
81                 public Guid Guid
82                 {
83                         get { return Guid.Empty; }
84                 }
85
86                 public string Name
87                 {
88                         get;
89                         private set;
90                 }
91
92                 public EventSourceSettings Settings
93                 {
94                         get;
95                         private set;
96                 }
97
98                 public bool IsEnabled ()
99                 {
100                         return false;
101                 }
102
103                 public bool IsEnabled (EventLevel level, EventKeywords keywords)
104                 {
105                         return false;
106                 }
107
108                 public bool IsEnabled (EventLevel level, EventKeywords keywords, EventChannel channel)
109                 {
110                         return false;
111                 }
112
113                 public void Dispose ()
114                 {
115                         Dispose (true);
116                 }
117
118                 public string GetTrait (string key)
119                 {
120                         return null;
121                 }
122
123                 public void Write (string eventName)
124                 {
125                 }
126
127                 public void Write<T> (string eventName, T data)
128                 {
129                 }
130
131                 public void Write<T> (string eventName, EventSourceOptions options, T data)
132                 {
133                 }
134
135                 public void Write<T> (string eventName, ref EventSourceOptions options, ref T data)
136                 {
137                 }
138
139                 public void Write<T> (string eventName, ref EventSourceOptions options, ref Guid activityId, ref Guid relatedActivityId, ref T data)
140                 {
141                 }
142
143                 protected virtual void Dispose (bool disposing)
144                 {
145                 }
146
147                 protected virtual void OnEventCommand (EventCommandEventArgs command)
148                 {
149                 }
150
151                 protected void WriteEvent (int eventId)
152                 {
153                 }
154
155                 protected void WriteEvent (int eventId, byte[] arg1)
156                 {
157                 }
158
159                 protected void WriteEvent (int eventId, int arg1)
160                 {
161                 }
162
163                 protected void WriteEvent (int eventId, string arg1)
164                 {
165                 }
166
167                 protected void WriteEvent (int eventId, int arg1, int arg2)
168                 {
169                 }
170
171                 protected void WriteEvent (int eventId, int arg1, int arg2, int arg3)
172                 {
173                 }
174
175                 protected void WriteEvent (int eventId, int arg1, string arg2)
176                 {
177                 }
178
179                 protected void WriteEvent (int eventId, long arg1)
180                 {
181                 }
182
183                 protected void WriteEvent (int eventId, long arg1, byte[] arg2)
184                 {
185                 }
186
187                 protected void WriteEvent (int eventId, long arg1, long arg2)
188                 {
189                 }
190
191                 protected void WriteEvent (int eventId, long arg1, long arg2, long arg3)
192                 {
193                 }
194
195                 protected void WriteEvent (int eventId, long arg1, string arg2)
196                 {
197                 }
198
199                 protected void WriteEvent (int eventId, params object[] args)
200                 {
201                 }
202
203                 protected void WriteEvent (int eventId, string arg1, int arg2)
204                 {
205                 }
206
207                 protected void WriteEvent (int eventId, string arg1, int arg2, int arg3)
208                 {
209                 }
210
211                 protected void WriteEvent (int eventId, string arg1, long arg2)
212                 {
213                 }
214
215                 protected void WriteEvent (int eventId, string arg1, string arg2)
216                 {
217                 }
218
219                 protected void WriteEvent (int eventId, string arg1, string arg2, string arg3)
220                 {
221                 }
222         }
223 }
224