/// <summary> /// 写日志 /// </summary> /// <param name="msg"></param> public static void Write(object msg) { try { var log = new NormalLog() { Date = DateTime.Now }; if (msg is ValueType || msg is string) { log.LogInfo = "[" + DateTime.Now.ToString("HH:mm:ss") + "]" + msg.ToString(); } else { log.LogInfo = "[" + DateTime.Now.ToString("HH:mm:ss") + "]" + Serialization.FormatterHelper.XMLSerObjectToString(msg); } LogControl.Instance.AsyncPushLog(log);//加入到队列中 } catch (Exception ex) { Console.WriteLine(ex.Message); } }
/// <summary> /// 写日志 /// </summary> /// <param name="msg"></param> public static void Write(string msg) { try { var log = new NormalLog() { Date = DateTime.Now, LogInfo = "[" + DateTime.Now.ToString("HH:mm:ss") + "]" + msg }; LogControl.Instance.AsyncPushLog(log);//加入到队列中 } catch (Exception ex) { Console.WriteLine(ex.Message); } }