码迷,mamicode.com
首页 > 其他好文 > 详细

C#中简单的写日志的方法

时间:2014-06-07 07:15:18      阅读:292      评论:0      收藏:0      [点我收藏+]

标签:c   a   string   os   line   new   

public static void WriteLog(string msg)
        {
            string appPath = AppDomain.CurrentDomain.BaseDirectory;
            string ServerPath = appPath + @"\Log" + DateTime.Now.ToString("yyyyMMdd") + ".txt";

            StreamWriter srWriter = new StreamWriter(ServerPath, true);
            string WriteStr = "************************************************************************************************\r\n";
            WriteStr += "Date:" + DateTime.Now.ToString() + "  \r\n" + msg;
            srWriter.WriteLine(WriteStr);
            srWriter.Close();
        }

C#中简单的写日志的方法,布布扣,bubuko.com

C#中简单的写日志的方法

标签:c   a   string   os   line   new   

原文地址:http://www.cnblogs.com/itjeff/p/3770631.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!