根目录生成TXT文本。
/// <summary>
/// 日志文件记录
/// </summary>
/// <param name="msg">写入信息</param>
public static void Log(string content)
{
try
{
string filename = DateTime.Now.ToString("yyyyMMdd") + ".txt";
string filePath = AppDomain.CurrentDomain.BaseDirectory + filename;
FileInfo file = new FileInfo(AppDomain.CurrentDomain.BaseDirectory + filename);
StringBuilder sb = new StringBuilder();
sb.Append(DateTime.Now.ToString());
sb.Append(" ");
sb.Append(content);
FileMode fm = new FileMode();
if (!file.Exists)
{
fm = FileMode.Create;
}
else
{
fm = FileMode.Append;