using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace UAS_AutoUpdate
{
class LogManager
{
public static string LogAddress = @"C:\UAS_MES";
///
/// 记录操作
///
///
public static void DoLog(string Message)
{
try
{
StreamWriter sw = File.AppendText(LogAddress + DateTime.Now.ToString("yyyy-MM-dd") + ".txt");
sw.WriteLine("\n【时间】" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\n");
sw.WriteLine("【消息】" + Message + "\n");
sw.WriteLine("---------------------------------------------------------------------------------------------------------------");
sw.Close();
}
catch (Exception) { }
}
///
/// 记录操作和SQL
///
///
///
public static void DoLog(string Message, string SQL)
{
try
{
StreamWriter sw = File.AppendText(LogAddress + DateTime.Now.ToString("yyyy-MM-dd") + ".txt");
sw.WriteLine("\n【时间】" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\n");
sw.WriteLine("【消息】" + Message + "\n");
sw.WriteLine("【SQL】" + SQL + "\n");
sw.WriteLine("---------------------------------------------------------------------------------------------------------------");
sw.Close();
}
catch (Exception) { }
}
///
/// 记录SQL
///
///
public static void DoSQLLog(string SQL)
{
try
{
StreamWriter sw = File.AppendText(LogAddress + DateTime.Now.ToString("yyyy-MM-dd") + ".txt");
sw.WriteLine("\n【时间】" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\n");
sw.WriteLine("【SQL】" + SQL + "\n");
sw.WriteLine("---------------------------------------------------------------------------------------------------------------");
sw.Close();
}
catch (Exception) { }
}
}
}