c#简单的调试信息、日志信息输出

public static void ErrorLog(string mssg)
{
string FilePath = "D:/logs/ErrorLog.txt";
try
{
if (System.IO.File.Exists(FilePath))
{
using (StreamWriter tw = System.IO.File.AppendText(FilePath))
{
tw.WriteLine(DateTime.Now.ToString() + "> " + mssg);
} //END using } //END if
else
{
StreamWriter tw = new StreamWriter(FilePath);
tw.WriteLine(DateTime.Now.ToString() + "> " + mssg);
tw.Flush();
tw.Close();
tw = null;
} //END else } //END Try
catch (Exception ex)
{ } //END Catch } // END ErrorLog

  

上一篇:HDOJ 1302(UVa 573) The Snail(蜗牛爬井)


下一篇:web 自定义标签