LogHelper

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();
        }
    }
}

你可能感兴趣的:(辅助工具方法)