Exemple #1
0
        /// <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);
            }
        }
Exemple #2
0
        /// <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);
            }
        }