2010-03-12 Jb Evain <jbevain@novell.com>
[mono.git] / mcs / class / System / System.Diagnostics / Debug.cs
1 //
2 // System.Diagnostics.Debug.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
37 namespace System.Diagnostics {
38
39         public sealed class Debug {
40
41                 private Debug () {}
42
43                 public static bool AutoFlush {
44                         get {return TraceImpl.AutoFlush;}
45                         set {TraceImpl.AutoFlush = value;}
46                 }
47
48                 public static int IndentLevel {
49                         get {return TraceImpl.IndentLevel;}
50                         set {TraceImpl.IndentLevel = value;}
51                 }
52
53                 public static int IndentSize {
54                         get {return TraceImpl.IndentSize;}
55                         set {TraceImpl.IndentSize = value;}
56                 }
57
58                 public static TraceListenerCollection Listeners {
59                         get {return TraceImpl.Listeners;}
60                 }
61
62                 [Conditional("DEBUG")]
63                 public static void Assert (bool condition)
64                 {
65                         TraceImpl.Assert (condition);
66                 }
67
68                 [Conditional("DEBUG")]
69                 public static void Assert (bool condition, string message)
70                 {
71                         TraceImpl.Assert (condition, message);
72                 }
73
74                 [Conditional("DEBUG")]
75                 public static void Assert (bool condition, string message, 
76                         string detailMessage)
77                 {
78                         TraceImpl.Assert (condition, message, detailMessage);
79                 }
80
81                 [Conditional("DEBUG")]
82                 public static void Close ()
83                 {
84                         TraceImpl.Close ();
85                 }
86
87                 [Conditional("DEBUG")]
88                 public static void Fail (string message)
89                 {
90                         TraceImpl.Fail (message);
91                 }
92
93                 [Conditional("DEBUG")]
94                 public static void Fail (string message, string detailMessage)
95                 {
96                         TraceImpl.Fail (message, detailMessage);
97                 }
98
99                 [Conditional("DEBUG")]
100                 public static void Flush ()
101                 {
102                         TraceImpl.Flush ();
103                 }
104
105                 [Conditional("DEBUG")]
106                 public static void Indent ()
107                 {
108                         TraceImpl.Indent ();
109                 }
110
111                 [Conditional("DEBUG")]
112                 public static void Unindent ()
113                 {
114                         TraceImpl.Unindent ();
115                 }
116
117                 [Conditional("DEBUG")]
118                 public static void Write (object value)
119                 {
120                         TraceImpl.Write (value);
121                 }
122
123                 [Conditional("DEBUG")]
124                 public static void Write (string message)
125                 {
126                         TraceImpl.Write (message);
127                 }
128
129                 [Conditional("DEBUG")]
130                 public static void Write (object value, string category)
131                 {
132                         TraceImpl.Write (value, category);
133                 }
134
135                 [Conditional("DEBUG")]
136                 public static void Write (string message, string category)
137                 {
138                         TraceImpl.Write (message, category);
139                 }
140
141                 [Conditional("DEBUG")]
142                 public static void WriteIf (bool condition, object value)
143                 {
144                         TraceImpl.WriteIf (condition, value);
145                 }
146
147                 [Conditional("DEBUG")]
148                 public static void WriteIf (bool condition, string message)
149                 {
150                         TraceImpl.WriteIf (condition, message);
151                 }
152
153                 [Conditional("DEBUG")]
154                 public static void WriteIf (bool condition, object value, 
155                         string category)
156                 {
157                         TraceImpl.WriteIf (condition, value, category);
158                 }
159
160                 [Conditional("DEBUG")]
161                 public static void WriteIf (bool condition, string message, 
162                         string category)
163                 {
164                         TraceImpl.WriteIf (condition, message, category);
165                 }
166
167                 [Conditional("DEBUG")]
168                 public static void WriteLine (object value)
169                 {
170                         TraceImpl.WriteLine (value);
171                 }
172
173                 [Conditional("DEBUG")]
174                 public static void WriteLine (string message)
175                 {
176                         TraceImpl.WriteLine (message);
177                 }
178
179                 [Conditional("DEBUG")]
180                 public static void WriteLine (object value, string category)
181                 {
182                         TraceImpl.WriteLine (value, category);
183                 }
184
185                 [Conditional("DEBUG")]
186                 public static void WriteLine (string message, string category)
187                 {
188                         TraceImpl.WriteLine (message, category);
189                 }
190
191                 [Conditional("DEBUG")]
192                 public static void WriteLineIf (bool condition, object value)
193                 {
194                         TraceImpl.WriteLineIf (condition, value);
195                 }
196
197                 [Conditional("DEBUG")]
198                 public static void WriteLineIf (bool condition, string message)
199                 {
200                         TraceImpl.WriteLineIf (condition, message);
201                 }
202
203                 [Conditional("DEBUG")]
204                 public static void WriteLineIf (bool condition, object value, 
205                         string category)
206                 {
207                         TraceImpl.WriteLineIf (condition, value, category);
208                 }
209
210                 [Conditional("DEBUG")]
211                 public static void WriteLineIf (bool condition, string message, 
212                         string category)
213                 {
214                         TraceImpl.WriteLineIf (condition, message, category);
215                 }
216
217 #if NET_2_0
218                 [Conditional("DEBUG")]
219                 public static void Print (string message)
220                 {
221                         TraceImpl.WriteLine (message);
222                 }
223
224                 [Conditional("DEBUG")]
225                 public static void Print (string format, params Object[] args)
226                 {
227                         TraceImpl.WriteLine (String.Format (format, args));
228                 }
229 #endif
230         }
231 }
232