public static void WriteTextLog(object objs)
{
try
{
DateTime time = DateTime.Now;
string path = AppDomain.CurrentDomain.BaseDirectory + "/Log/" + time.ToString("yyyy-MM") + "/";
if (!Directory.Exists(path))
Directory.CreateDirectory(path);
string fileFullPath = path + time.ToString("yyyy-MM-dd") + ".txt";
StringBuilder str = new StringBuilder();
str.Append(objs);
StreamWriter sw;
if (!File.Exists(fileFullPath))
{
sw = File.CreateText(fileFullPath);
}
else
{
sw = File.AppendText(fileFullPath);
}
sw.WriteLine(str.ToString());
sw.Close();
}
catch (Exception)
{
}
}