TraceSwitch.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. //
  2. // System.Diagnostics.TraceSwtich.cs
  3. //
  4. // Author:
  5. // John R. Hicks ([email protected])
  6. //
  7. // (C) 2001
  8. //
  9. namespace System.Diagnostics
  10. {
  11. /// <summary>
  12. /// Multi-level switch to provide tracing and debug output without
  13. /// recompiling.
  14. /// </summary>
  15. public class TraceSwitch : Switch
  16. {
  17. private TraceLevel level;
  18. private bool traceError = false;
  19. private bool traceInfo = false;
  20. private bool traceVerbose = false;
  21. private bool traceWarning = false;
  22. /// <summary>
  23. /// Initializes a new instance
  24. /// </summary>
  25. /// <param name="displayName">Name for the switch</param>
  26. /// <param name="description">Description of the switch</param>
  27. public TraceSwitch(string displayName, string description)
  28. : base(displayName, description)
  29. {
  30. }
  31. /// <summary>
  32. /// Gets or sets the trace level that specifies the messages to
  33. /// output for tracing and debugging.
  34. /// </summary>
  35. public TraceLevel Level
  36. {
  37. get
  38. {
  39. return level;
  40. }
  41. set
  42. {
  43. level = value;
  44. }
  45. }
  46. /// <summary>
  47. /// Gets a value indicating whether the Level is set to Error,
  48. /// Warning, Info, or Verbose.
  49. /// </summary>
  50. public bool TraceError
  51. {
  52. get
  53. {
  54. return traceError;
  55. }
  56. }
  57. /// <summary>
  58. /// Gets a value indicating whether the Level is set to Info or Verbose.
  59. /// </summary>
  60. public bool TraceInfo
  61. {
  62. get
  63. {
  64. return traceInfo;
  65. }
  66. }
  67. /// <summary>
  68. /// Gets a value indicating whether the Level is set to Verbose.
  69. /// </summary>
  70. public bool TraceVerbose
  71. {
  72. get
  73. {
  74. return traceVerbose;
  75. }
  76. }
  77. /// <summary>
  78. /// Gets a value indicating whether the Level is set to
  79. /// Warning, Info, or Verbose.
  80. /// </summary>
  81. public bool TraceWarning
  82. {
  83. get
  84. {
  85. return traceWarning;
  86. }
  87. }
  88. }
  89. }