Use TraceSwitch to control Debug and Trace
The TraceSwitch class defines four levels of information logging. They are defined in the TraceLevel enum.
ITPro Today
July 21, 2004
4 Min Read
The TraceSwitch class defines four levels of information logging. They are defined in the TraceLevel enum.
LEVEL | NUMERIC VALUE |
---|---|
Off | 0 |
Error | 1 |
Warning | 2 |
Info | 3 |
Verbose | 4 |
Each of the higher levels implies the lower level; if the level is set to Info, Error and Warning will also be set. The numeric values are used when setting the flag via an environment variable or registry setting.
The TraceSwitch class exposes properties that tell whether a specific trace level has been set, and a typical logging statement would check to see whether the appropriate property was set.
About the Author
Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
You May Also Like