26 lines
792 B
C#
26 lines
792 B
C#
|
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) { }
|
|||
|
}
|
|||
|
}
|
|||
|
}
|