12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- namespace UAS_DXFORM
- {
- class LogManager
- {
- public static string LogAddress = SystemInf.LogFolder;
- /// <summary>
- /// 记录操作
- /// </summary>
- /// <param name="Message"></param>
- 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) { }
- }
- /// <summary>
- /// 记录操作
- /// </summary>
- /// <param name="Message"></param>
- public static void DoLog(List<String> Message,string info)
- {
- 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("【消息】" + info + "\n");
- foreach (string mes in Message)
- {
- sw.WriteLine(mes + "\n");
- }
- //int T = Message.Count;
- //for (int i = 0; i < T; i++)
- //{
- // sw.WriteLine(Message[i].ToString() + "\n");
- //}
- sw.WriteLine("---------------------------------------------------------------------------------------------------------------");
- sw.Close();
- }
- catch (Exception) { }
- }
-
- }
- }
|