title: write to log file class
body: <p>I am just wondering on a good way to write to log.</p>
  
  <p>I've created a singleton class Logger which has 2 methods: Write(eventDate, messageType, message)
  and <code>Dispose().</code></p>
  
  <p>In constructor I create <code>StreamWriter</code> (with AutoFlush set to true) which is used to append lines in a Write method.  Logging is used extensively (but in one thread), about 10-15 records per second.</p>
  
  <p>Now I reflect on the following two questions, comments on which I expect from you :)</p>
  
  <p>First is autoflushing - does it open and close file all the time?  Is <code>File.AppendText</code> similar?</p>
  
  <p>Second, in Dispose I flush <code>StreamWriter</code> and then call Dispose on it.  What if Dispose isn't called?  How can I make sure it will be disposed of?  Because if I remove AutoFlush and will flush the stream time to time (may be by maintaining inner counter) and when n records are written to buffer, I'd flush it, but what if less than n records are written and program terminates?</p>