[Mono-list] Diagnostic Messages

Jonathan Pryor jonpryor@vt.edu
25 May 2002 22:39:46 -0400


Looking at the CVS check-ins that have been occurring over the last
several weeks/months, I've noticed that lots of existing code has had
diagnostic messages (e.g. "Console.WriteLine") messages removed from
their source, primarily because they're only of concern to the
developer.

This need not be the case.  Instead, the handy
`System.Diagnostics.Trace' and `System.Diagnostics.Debug' classes could
be used, which (by default, on Windows) do not display any console
output.  This would allow developers to still see the messages (if they
need to), without having them be seen by end-users.

The problem is that things don't behave this way under Mono, as the
current `DefaultTraceListener' class sends all output messages to the
console.  I originally did this because it was easy, but I'd like to
replace this with something more functional.

My current idea for "more functional" is that we add a new argument to
mono/mint: 

	--diagnostics=[trace | debug | all]

If `--diagnostics' isn't present, then no diagnostic messages are
generated.  If `--diagnostics=trace', then only calls to
`System.Diagnostics.Trace' would be displayed.  Similarly, if
`--diagnostics=debug', then only calls to `System.Diagnostics.Debug'
would be displayed.  `--diagnostics=all' would show messages sent to
both `System.Diagnostics.Trace' and `System.Diagnostics.Debug'.

I am willing to implement this if everyone agrees that it's a good
idea.  I am (of course) also open to alternative suggestions.

Thanks,
 - Jon