Trace.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. //
  2. // System.Diagnostics.Trace.cs
  3. //
  4. // Authors:
  5. // Jonathan Pryor ([email protected])
  6. //
  7. // Comments from John R. Hicks <[email protected]> original implementation
  8. // can be found at: /mcs/docs/apidocs/xml/en/System.Diagnostics
  9. //
  10. // (C) 2002
  11. //
  12. //
  13. // Permission is hereby granted, free of charge, to any person obtaining
  14. // a copy of this software and associated documentation files (the
  15. // "Software"), to deal in the Software without restriction, including
  16. // without limitation the rights to use, copy, modify, merge, publish,
  17. // distribute, sublicense, and/or sell copies of the Software, and to
  18. // permit persons to whom the Software is furnished to do so, subject to
  19. // the following conditions:
  20. //
  21. // The above copyright notice and this permission notice shall be
  22. // included in all copies or substantial portions of the Software.
  23. //
  24. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  25. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  26. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  27. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  28. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  29. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  30. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  31. //
  32. using System;
  33. using System.Diagnostics;
  34. namespace System.Diagnostics {
  35. public sealed class Trace {
  36. private Trace () {}
  37. public static bool AutoFlush {
  38. get {return TraceImpl.AutoFlush;}
  39. set {TraceImpl.AutoFlush = value;}
  40. }
  41. public static int IndentLevel {
  42. get {return TraceImpl.IndentLevel;}
  43. set {TraceImpl.IndentLevel = value;}
  44. }
  45. public static int IndentSize {
  46. get {return TraceImpl.IndentSize;}
  47. set {TraceImpl.IndentSize = value;}
  48. }
  49. public static TraceListenerCollection Listeners {
  50. get {return TraceImpl.Listeners;}
  51. }
  52. [Conditional("TRACE")]
  53. public static void Assert (bool condition)
  54. {
  55. TraceImpl.Assert (condition);
  56. }
  57. [Conditional("TRACE")]
  58. public static void Assert (bool condition, string message)
  59. {
  60. TraceImpl.Assert (condition, message);
  61. }
  62. [Conditional("TRACE")]
  63. public static void Assert (bool condition, string message,
  64. string detailMessage)
  65. {
  66. TraceImpl.Assert (condition, message, detailMessage);
  67. }
  68. [Conditional("TRACE")]
  69. public static void Close ()
  70. {
  71. TraceImpl.Close ();
  72. }
  73. [Conditional("TRACE")]
  74. public static void Fail (string message)
  75. {
  76. TraceImpl.Fail (message);
  77. }
  78. [Conditional("TRACE")]
  79. public static void Fail (string message, string detailMessage)
  80. {
  81. TraceImpl.Fail (message, detailMessage);
  82. }
  83. [Conditional("TRACE")]
  84. public static void Flush ()
  85. {
  86. TraceImpl.Flush ();
  87. }
  88. [Conditional("TRACE")]
  89. public static void Indent ()
  90. {
  91. TraceImpl.Indent ();
  92. }
  93. [Conditional("TRACE")]
  94. public static void Unindent ()
  95. {
  96. TraceImpl.Unindent ();
  97. }
  98. [Conditional("TRACE")]
  99. public static void Write (object value)
  100. {
  101. TraceImpl.Write (value);
  102. }
  103. [Conditional("TRACE")]
  104. public static void Write (string message)
  105. {
  106. TraceImpl.Write (message);
  107. }
  108. [Conditional("TRACE")]
  109. public static void Write (object value, string category)
  110. {
  111. TraceImpl.Write (value, category);
  112. }
  113. [Conditional("TRACE")]
  114. public static void Write (string message, string category)
  115. {
  116. TraceImpl.Write (message, category);
  117. }
  118. [Conditional("TRACE")]
  119. public static void WriteIf (bool condition, object value)
  120. {
  121. TraceImpl.WriteIf (condition, value);
  122. }
  123. [Conditional("TRACE")]
  124. public static void WriteIf (bool condition, string message)
  125. {
  126. TraceImpl.WriteIf (condition, message);
  127. }
  128. [Conditional("TRACE")]
  129. public static void WriteIf (bool condition, object value,
  130. string category)
  131. {
  132. TraceImpl.WriteIf (condition, value, category);
  133. }
  134. [Conditional("TRACE")]
  135. public static void WriteIf (bool condition, string message,
  136. string category)
  137. {
  138. TraceImpl.WriteIf (condition, message, category);
  139. }
  140. [Conditional("TRACE")]
  141. public static void WriteLine (object value)
  142. {
  143. TraceImpl.WriteLine (value);
  144. }
  145. [Conditional("TRACE")]
  146. public static void WriteLine (string message)
  147. {
  148. TraceImpl.WriteLine (message);
  149. }
  150. [Conditional("TRACE")]
  151. public static void WriteLine (object value, string category)
  152. {
  153. TraceImpl.WriteLine (value, category);
  154. }
  155. [Conditional("TRACE")]
  156. public static void WriteLine (string message, string category)
  157. {
  158. TraceImpl.WriteLine (message, category);
  159. }
  160. [Conditional("TRACE")]
  161. public static void WriteLineIf (bool condition, object value)
  162. {
  163. TraceImpl.WriteLineIf (condition, value);
  164. }
  165. [Conditional("TRACE")]
  166. public static void WriteLineIf (bool condition, string message)
  167. {
  168. TraceImpl.WriteLineIf (condition, message);
  169. }
  170. [Conditional("TRACE")]
  171. public static void WriteLineIf (bool condition, object value,
  172. string category)
  173. {
  174. TraceImpl.WriteLineIf (condition, value, category);
  175. }
  176. [Conditional("TRACE")]
  177. public static void WriteLineIf (bool condition, string message,
  178. string category)
  179. {
  180. TraceImpl.WriteLineIf (condition, message, category);
  181. }
  182. }
  183. }