ZHJA_HJGL/HJGL_ZH/BLL/Logger.cs

26 lines
792 B
C#
Raw Normal View History

2024-05-08 17:17:11 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace RLSB
{
public class Logger
{
public static void WriteLog(HttpServerUtility Server,string str)
{
try
{
string strFilePath = Server.MapPath("log/" + DateTime.Now.ToString("%y-%M-%D-%Hh")+".txt");
System.IO.FileStream fs = new System.IO.FileStream(strFilePath, System.IO.FileMode.Append);
System.IO.StreamWriter sw = new System.IO.StreamWriter(fs, System.Text.Encoding.Default);
sw.Write("'" + DateTime.Now.ToString() + "':");
sw.WriteLine(str);
sw.Close();
fs.Close();
}
catch (Exception) { }
}
}
}