title: Change textwriter to write to console
body: <p>I have this existing function that I would like to convert so it will print the logMessage out to the console.  Originally this was used as a cmd line app that i have converted to a windows form application in C#.    How do i change the output stream so it would write to a file or the console?</p>
  
  <pre><code>   /// &lt;summary&gt;
      /// Prints a log message to stderr.
      /// &lt;/summary&gt;
  
  public static void logMessage(String format, params Object[] args)
      { //Change output stream if desired
          TextWriter logStream = Console.Error;
          Console.OutputEncoding = System.Text.Encoding.UTF8;
          logStream.WriteLine(logTime() + " " + format, args);
      }
  </code></pre>