日志Helper

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;

namespace WEBAPI.Models
{
    public class LogHelper
    {
        public static void WriteLog(string msg)
        {
            FileStream fs = new FileStream(@"C:\Log.data", FileMode.Append);
            StreamWriter sw = new StreamWriter(fs);
            sw.WriteLine(DateTime.Now.ToLongTimeString() + ":" + msg);
            sw.Flush();
            sw.Close();
            fs.Close();
        }
    }
}
发布了43 篇原创文章 · 获赞 35 · 访问量 1565

猜你喜欢

转载自blog.csdn.net/qq_45244974/article/details/103940073