代码改变世界

最简单的日志

2013-04-06 22:49  hongjiumu  阅读(161)  评论(7编辑  收藏  举报

最简单的日志:

public class Logger
{
    public static void Trace(string title,string message)
    {
        string path = System.Windows.Forms.Application.StartupPath + "\\Log.txt";
 
        StreamWriter sw = new StreamWriter(path,true);
        sw.Write("{0}:{1}", title, message);
        sw.Flush();
        sw.Close();
    }
}