Exemplo n.º 1
0
        /// <summary>
        /// 写入异常日志
        /// </summary>
        /// <param name="log">日志信息</param>
        public void WriteException(ExceptionLog log)
        {
            StringBuilder content = new StringBuilder();

            content.Append(DateTime.Now.ToString("日志时间:yyyy-MM-dd HH:mm:ss") + Environment.NewLine);
            content.Append("Level:" + log.LogLevel + Environment.NewLine);
            content.Append("--------------------------------Start---------------------------------------" + Environment.NewLine);
            content.Append(log.ToJson() + Environment.NewLine);
            content.Append("--------------------------------End-----------------------------------------" + Environment.NewLine);
            content.Append(Environment.NewLine);
            WriteText(log.LogLevel, content.ToString());
        }