public void Add(string content, ProcessResultType result, string response = "NullorEmpty", string[] param = null) { var item = new ProcessResultItem(response, param ?? new string[] { "没有参数" }, content, result); Console.WriteLine(Format(item)); Record(item); }
private void Record(ProcessResultItem item) { LogSession.Log.Add(item); Log.Add(item); try { var path = string.Format("D:\\MainLog{0}.{1}", DateTime.Now.ToString("yy-MM-dd"), "txt"); File.AppendAllLines(path, new List <string>() { Format(item) }); } catch (Exception e) { Console.WriteLine(e); throw; } }
private string Format(ProcessResultItem item) { return(string.Format("活动:{0} \t 参数:{1} \t 返回值:{2} \t 结果:{3} \t 时间:{4}", item.Content, GetStr(item.Param), item.Response, item.Result, DateTime.Now.ToString("u"))); }
public void Add(ProcessResultItem item) { Console.WriteLine(Format(item)); Record(item); }