using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Core.Mes.Client.Comm.Tool
{
public class LogHelper
{
#region 记录系统运行日志
///
/// 写日志
///
/// 模块名称
/// 日志
public static void WriteLogs(string strModelName, string str)
{
try
{
string m_szRunPath = System.Environment.CurrentDirectory.ToString();
string strLogPath = m_szRunPath + "\\log";
if (!(System.IO.Directory.Exists(strLogPath)))
{
System.IO.Directory.CreateDirectory(strLogPath);
}
strLogPath = m_szRunPath + "\\log\\" + strModelName + "_" + System.DateTime.Now.ToString("yyyyMMddhh") + ".log";
System.IO.TextWriter tw = new System.IO.StreamWriter(strLogPath, true);
//tw.Encoding = new e
tw.WriteLine(System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
tw.WriteLine(str);
tw.WriteLine("\r\n");
tw.Close();
tw.Dispose();
}
catch
{
//throw;
}
}
#endregion
}
}