System.Drawing: added email to icon and test file headers
[mono.git] / mcs / class / System / System.Diagnostics / Trace.cs
1 //
2 // System.Diagnostics.Trace.cs
3 //
4 // Authors:
5 //   Jonathan Pryor (jonpryor@vt.edu)
6 //
7 // Comments from John R. Hicks <angryjohn69@nc.rr.com> original implementation 
8 // can be found at: /mcs/docs/apidocs/xml/en/System.Diagnostics
9 //
10 // (C) 2002
11 //
12
13 //
14 // Permission is hereby granted, free of charge, to any person obtaining
15 // a copy of this software and associated documentation files (the
16 // "Software"), to deal in the Software without restriction, including
17 // without limitation the rights to use, copy, modify, merge, publish,
18 // distribute, sublicense, and/or sell copies of the Software, and to
19 // permit persons to whom the Software is furnished to do so, subject to
20 // the following conditions:
21 // 
22 // The above copyright notice and this permission notice shall be
23 // included in all copies or substantial portions of the Software.
24 // 
25 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
29 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
30 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
31 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 //
33
34 using System;
35 using System.Diagnostics;
36 using System.Reflection;
37
38 namespace System.Diagnostics {
39
40         public sealed class Trace {
41
42                 private Trace () {}
43
44 #if NET_2_0
45                 [MonoNotSupported ("")]
46                 public static void Refresh ()
47                 {
48                         throw new NotImplementedException ();
49                 }
50 #endif
51
52                 public static bool AutoFlush {
53                         get {return TraceImpl.AutoFlush;}
54                         set {TraceImpl.AutoFlush = value;}
55                 }
56
57                 public static int IndentLevel {
58                         get {return TraceImpl.IndentLevel;}
59                         set {TraceImpl.IndentLevel = value;}
60                 }
61
62                 public static int IndentSize {
63                         get {return TraceImpl.IndentSize;}
64                         set {TraceImpl.IndentSize = value;}
65                 }
66
67                 public static TraceListenerCollection Listeners {
68                         get {return TraceImpl.Listeners;}
69                 }
70
71 #if NET_2_0
72                 public static CorrelationManager CorrelationManager {
73                         get { return TraceImpl.CorrelationManager; }
74                 }
75
76                 public
77 #else
78                 internal
79 #endif
80                 static bool UseGlobalLock {
81                         get { return TraceImpl.UseGlobalLock; }
82                         set { TraceImpl.UseGlobalLock = value; }
83                 }
84
85                 [Conditional("TRACE")]
86                 public static void Assert (bool condition)
87                 {
88                         TraceImpl.Assert (condition);
89                 }
90
91                 [Conditional("TRACE")]
92                 public static void Assert (bool condition, string message)
93                 {
94                         TraceImpl.Assert (condition, message);
95                 }
96
97                 [Conditional("TRACE")]
98                 public static void Assert (bool condition, string message, 
99                         string detailMessage)
100                 {
101                         TraceImpl.Assert (condition, message, detailMessage);
102                 }
103
104                 [Conditional("TRACE")]
105                 public static void Close ()
106                 {
107                         TraceImpl.Close ();
108                 }
109
110                 [Conditional("TRACE")]
111                 public static void Fail (string message)
112                 {
113                         TraceImpl.Fail (message);
114                 }
115
116                 [Conditional("TRACE")]
117                 public static void Fail (string message, string detailMessage)
118                 {
119                         TraceImpl.Fail (message, detailMessage);
120                 }
121
122                 [Conditional("TRACE")]
123                 public static void Flush ()
124                 {
125                         TraceImpl.Flush ();
126                 }
127
128                 [Conditional("TRACE")]
129                 public static void Indent ()
130                 {
131                         TraceImpl.Indent ();
132                 }
133
134                 [Conditional("TRACE")]
135                 public static void Unindent ()
136                 {
137                         TraceImpl.Unindent ();
138                 }
139
140                 [Conditional("TRACE")]
141                 public static void Write (object value)
142                 {
143                         TraceImpl.Write (value);
144                 }
145
146                 [Conditional("TRACE")]
147                 public static void Write (string message)
148                 {
149                         TraceImpl.Write (message);
150                 }
151
152                 [Conditional("TRACE")]
153                 public static void Write (object value, string category)
154                 {
155                         TraceImpl.Write (value, category);
156                 }
157
158                 [Conditional("TRACE")]
159                 public static void Write (string message, string category)
160                 {
161                         TraceImpl.Write (message, category);
162                 }
163
164                 [Conditional("TRACE")]
165                 public static void WriteIf (bool condition, object value)
166                 {
167                         TraceImpl.WriteIf (condition, value);
168                 }
169
170                 [Conditional("TRACE")]
171                 public static void WriteIf (bool condition, string message)
172                 {
173                         TraceImpl.WriteIf (condition, message);
174                 }
175
176                 [Conditional("TRACE")]
177                 public static void WriteIf (bool condition, object value, 
178                         string category)
179                 {
180                         TraceImpl.WriteIf (condition, value, category);
181                 }
182
183                 [Conditional("TRACE")]
184                 public static void WriteIf (bool condition, string message, 
185                         string category)
186                 {
187                         TraceImpl.WriteIf (condition, message, category);
188                 }
189
190                 [Conditional("TRACE")]
191                 public static void WriteLine (object value)
192                 {
193                         TraceImpl.WriteLine (value);
194                 }
195
196                 [Conditional("TRACE")]
197                 public static void WriteLine (string message)
198                 {
199                         TraceImpl.WriteLine (message);
200                 }
201
202                 [Conditional("TRACE")]
203                 public static void WriteLine (object value, string category)
204                 {
205                         TraceImpl.WriteLine (value, category);
206                 }
207
208                 [Conditional("TRACE")]
209                 public static void WriteLine (string message, string category)
210                 {
211                         TraceImpl.WriteLine (message, category);
212                 }
213
214                 [Conditional("TRACE")]
215                 public static void WriteLineIf (bool condition, object value)
216                 {
217                         TraceImpl.WriteLineIf (condition, value);
218                 }
219
220                 [Conditional("TRACE")]
221                 public static void WriteLineIf (bool condition, string message)
222                 {
223                         TraceImpl.WriteLineIf (condition, message);
224                 }
225
226                 [Conditional("TRACE")]
227                 public static void WriteLineIf (bool condition, object value, 
228                         string category)
229                 {
230                         TraceImpl.WriteLineIf (condition, value, category);
231                 }
232
233                 [Conditional("TRACE")]
234                 public static void WriteLineIf (bool condition, string message, 
235                         string category)
236                 {
237                         TraceImpl.WriteLineIf (condition, message, category);
238                 }
239
240 #if NET_2_0
241                 static void DoTrace (string kind, Assembly report, string message)
242                 {
243                         TraceImpl.WriteLine (String.Format ("{0} {1} : 0 : {2}", report.Location, kind, message));
244                 }
245                 
246                 [Conditional("TRACE")]
247                 public static void TraceError (string message)
248                 {
249                         DoTrace ("Error", Assembly.GetCallingAssembly (), message);
250                 }
251
252                 [Conditional("TRACE")]
253                 public static void TraceError (string message, params object [] args)
254                 {
255                         DoTrace ("Error", Assembly.GetCallingAssembly (), String.Format (message, args));
256                 }
257
258                 [Conditional("TRACE")]
259                 public static void TraceInformation (string message)
260                 {
261                         DoTrace ("Information", Assembly.GetCallingAssembly (), message);
262                 }
263
264                 [Conditional("TRACE")]
265                 public static void TraceInformation (string message, params object [] args)
266                 {
267                         DoTrace ("Information", Assembly.GetCallingAssembly (), String.Format (message, args));
268                 }
269
270                 [Conditional("TRACE")]
271                 public static void TraceWarning (string message)
272                 {
273                         DoTrace ("Warning", Assembly.GetCallingAssembly (), message);
274                 }
275
276                 [Conditional("TRACE")]
277                 public static void TraceWarning (string message, params object [] args)
278                 {
279                         DoTrace ("Warning", Assembly.GetCallingAssembly (), String.Format (message, args));
280                 }
281 #endif
282         }
283 }
284
285