title: Error logging in C#
body: <p>I am making my switch from coding in C++ to C#.  I need to replace my C++ error logging/reporting macro system with something similar in C#.</p>
  
  <p>In my C++ source I can write</p>
  
  <p>LOGERR("Some error");
  or
  LOGERR("Error with inputs %s and %d", stringvar, intvar);</p>
  
  <p>The macro &amp; supporting library code then passes the (possibly varargs) formatted message into a database along with the source file, source line, user name, and time.  The same data is also stuffed into a data structure for later reporting to the user.</p>
  
  <p>Does anybody have C# code snippets or pointers to examples that do this basic error reporting/logging?</p>
  
  <p><strong>Edit:</strong>  At the time I asked this question I was really new to .NET and was unaware of System.Diagnostics.Trace.  System.Diagnostics.Trace was what I needed at that time.  Since then I have used log4net on projects where the logging requirements were larger and more complex.  Just edit that 500 line XML configuration file and log4net will do everything you will ever need :)</p>