We initially didn\'t use any logging or debug tracing but after spending few weeks to trace down some data corruption we decided to put required Debug.Write and Trace for produc
You are using it fine except for Assert
with first argument hardcoded to true
. You should probably add some condition there and the message (second argument) will be printed only if the condition is false. So in your code example it will never be displayed. In some cases WriteLineIf
may come in handy if you don't want to wrap your debug statements in conditional blocks.
Check out the Debug class reference it has quite a few useful methods and properties to help you log things.