using System;
|
|
using System.IO;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace B3ButcherWeightClient
|
|
{
|
|
public class LogUtil {
|
|
static string LogPath {
|
|
get {
|
|
return Application.StartupPath + "\\" + DateTime.Today.ToString("yyyyMMdd") + "ErrorLog.txt";
|
|
}
|
|
}
|
|
|
|
public static void WriteLog(string msg) {
|
|
try {
|
|
using (var writer = new StreamWriter(LogPath, true, Encoding.UTF8)) {
|
|
writer.WriteLine(msg);
|
|
writer.WriteLine();
|
|
writer.Close();
|
|
writer.Dispose();
|
|
}
|
|
} catch (Exception ex) {
|
|
MessageBox.Show(ex.Message);
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|