A Trace Antipattern
More than once have I seen tracing frameworks with "levels" in them, like this:
-
TraceMessage(int level, string message)
The idea is that you state the importance or severity of your trace statement along with the message. This way, you can set a threshold when you watch the output. If you only want to see the very severe messages, you will set this threshold to high. In theory a very good idea, but in practice it doesn't seem to work. At least, I haven't seen anybody actually use it. I guess the reason is that when you're looking for a bug in your debug messages, you don't know what you're looking for and the hint might as well be in a seemingly unimportant message that pops up somewhere suspicious. So just to make sure, you set the threshold to "everything", and keep it there.
The concept of "levels", it seems, simply works very poorly with a task like debugging because errors can hide in the most innocently looking piece of code.
By the way, if you program for Windows, you should know about DebugView from SysInternals, a really helpful tool for monitoring trace statements.