欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

C# 存储日志

程序员文章站 2023-08-25 13:01:40
存储日志 public void log(string neirong) { var path = @"D:\xx文件名xx\Log\" + "日志" + ".log"; using (StreamWriter st = new StreamWriter(path, append: true)) { ......

 存储日志

 public void log(string neirong)
        {
            var path = @"d:\xx文件名xx\log\" + "日志" + ".log";
            using (streamwriter st = new streamwriter(path, append: true))
            {
                st.writeline( "  " + datetime.now + "  " + neirong);
            }
        }