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