c# log
public static void WritetLog(string strMessage)
{
string path = AppDomain.CurrentDomain.BaseDirectory;
if (!Directory.Exists(path))
Directory.CreateDirectory(path);
string fileFullPath = path + DateTime.Now.ToString("yyyy-MM-dd") + ".openIdNotMember.txt";
StringBuilder str = new StringBuilder();
str.Append(strMessage);
StreamWriter sw;
if (!File.Exists(fileFullPath))
{
sw = File.CreateText(fileFullPath);
}
else
{
sw = File.AppendText(fileFullPath);
}
sw.WriteLine(str.ToString());
sw.Close();
}

浙公网安备 33010602011771号