You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
854 B
C#

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StartServerWPF.Assets
{
public class LogHelper
{
public static void WriteSerLog(string fn, string logstr)
{
// try
{
fn = fn + "SerLog_" + DateTime.Now.ToString("yyyyMMdd") + ".txt";
if (!File.Exists(fn))
{
Directory.CreateDirectory(Path.GetDirectoryName(fn));
}
using (StreamWriter sw = new StreamWriter(fn, true, Encoding.Default))
{
sw.WriteLine(logstr);
sw.Close();
}
}
//catch (Exception ex)
//{
//}
}
}
}