常用Common集合

Log
using System;
using System.IO;
using System.Linq;
using System.Text;

namespace Common
{
    public class Log
    {
        public static void Writer(Exception ex, string title)
        {
            using (StreamWriter sw = new StreamWriter(AppDomain.CurrentDomain.BaseDirectory + "\log.txt", true))
            {
                sw.WriteLine("============时间:" + DateTime.Now.ToString() + "=======================");
                sw.WriteLine("========================" + title + "===============================");
                sw.WriteLine("异常信息:" + ex.ToString());
            }
        }
    }
}
View Code
原文地址:https://www.cnblogs.com/lee2011/p/6066304.html