예제 #1
0
        /// <summary>
        /// 日志写入
        /// </summary>
        /// <param name="theRecordGrade">日志级别</param>
        /// <param name="msgHeader">日志消息头信息</param>
        /// <param name="exception">异常消息信息</param>
        /// <remarks>Version:1.1.3.0</remarks>
        public override void WriteLog(Int32 theRecordGrade, String msgHeader, Exception exception)
        {
            if (theRecordGrade < TXTLogFactory.GetLogGrade(LogConfig))
            {
                return;
            }
            var        stackFrames = new StackTrace(exception, true).GetFrames();
            StackFrame stackFrame  = null;

            if (stackFrames != null)
            {
                stackFrame = stackFrames.Last();
            }
            var logrec = LogFormatter.FormatLogRecord(PrepareLogHeader(), PrepareLogBody("【" + msgHeader + "】" + exception.Message), stackFrame);

            if (logrec != null)
            {
                LogRecordList.Add(logrec);
            }
        }
예제 #2
0
        /// <summary>
        /// 日志记录
        /// </summary>
        /// <param name="msgHeader">异常消息头信息</param>
        /// <param name="logMessage">日志信息</param>
        /// <remarks>Version:1.1.4.0</remarks>
        public override void WriteLog(String msgHeader, String logMessage)
        {
            if (DefaultLogGrade < TXTLogFactory.GetLogGrade(LogConfig))
            {
                return;
            }
            var        stackFrames = new StackTrace(true).GetFrames();
            StackFrame stackFrame  = null;

            if (stackFrames != null)
            {
                stackFrame = stackFrames[1];
            }
            var logrec = LogFormatter.FormatLogRecord(PrepareLogHeader(), PrepareLogBody("【" + msgHeader + "】" + logMessage), stackFrame);

            if (logrec != null)
            {
                LogRecordList.Add(logrec);
            }
        }
예제 #3
0
        /// <summary>
        /// 日志记录
        /// </summary>
        /// <param name="theRecordGrade">日志级别</param>
        /// <param name="logMessage">日志信息</param>
        public override void WriteLog(Int32 theRecordGrade, string logMessage)
        {
            if (theRecordGrade < TXTLogFactory.GetLogGrade(LogConfig))
            {
                return;
            }
            //**********VERSION 1.1.1.0 START**********//
            var        stackFrames = new StackTrace(true).GetFrames();
            StackFrame stackFrame  = null;

            if (stackFrames != null)
            {
                stackFrame = stackFrames[1];
            }
            //**********VERSION 1.1.1.0 END**********//
            var logrec = LogFormatter.FormatLogRecord(PrepareLogHeader(), PrepareLogBody(logMessage), stackFrame);

            if (logrec != null)
            {
                LogRecordList.Add(logrec);
            }
        }
예제 #4
0
        /// <summary>
        /// 日志记录
        /// </summary>
        /// <param name="exception">异常信息</param>
        public override void WriteLog(Exception exception)
        {
            if (DefaultLogGrade < TXTLogFactory.GetLogGrade(LogConfig))
            {
                return;
            }
            //**********VERSION 1.1.1.0 START**********//
            var        stackFrames = new StackTrace(exception, true).GetFrames();
            StackFrame stackFrame  = null;

            if (stackFrames != null)
            {
                stackFrame = stackFrames.Last();
            }
            //**********VERSION 1.1.1.0 END**********//
            var logrec = LogFormatter.FormatLogRecord(PrepareLogHeader(), PrepareLogBody(exception.Message), stackFrame);

            if (logrec != null)
            {
                LogRecordList.Add(logrec);
            }
        }