On Wed, 22 Oct 2008 07:18:10 -0700, rodchar
<ro*****@discussions.microsoft.comwrote:
hi all,
i have a console app that takes care of a process that involves several
steps. And at each of those steps i report to the console that status of
the
process. So I have all these System.Console statements thru out all my
classes.
Is there a better way to manage these messages? better design pattern?
If you're trying to emit status messages, then you'll have to call
_something_ to do that. In many cases, Console.WriteLine() is as good as
anything.
That said, you might look into the TraceListener class and related.
That's similar to using the Diagnostics.Debug class Pete M. mentioned (in
fact, that's implemented as a provider for the default TraceListener).
Using TraceListener gives you more flexibility in terms of where the
output goes, in that you don't have to co-opt the standard output string
to change the output, and you can have multiple output destinations.
Pete