I\'m trying to use System.Diagnostics to do some very basic logging. I figure I\'d use what\'s in the box rather than taking on an extra dependency like Log4Net or EntLib. <
Check the state of dataSwitch whenever you need to log, as per:
http://msdn.microsoft.com/en-us/library/aa984285%28v=VS.71%29.aspx
However, that is pretty nasty, having to put those checks everywhere. Is their a reason you don't want to simply remove the TraceListener from the listeners collection in app.config?
Apart from that, I'd investigate using the .NET 2.0+ trace stuff which includes TraceSource. The new(er) stuff offers a much higher degree of configuration, and you might find it's more suitable.
http://msdn.microsoft.com/en-us/library/ms228993.aspx