예제 #1
0
        /// <summary>
        ///   记录日志
        /// </summary>
        /// <param name="level"> 所在等级 </param>
        /// <param name="name"> 原始的消息 </param>
        /// <param name="msg"> 处理后的消息 </param>
        /// <param name="type"> 日志类型 </param>
        /// <param name="typeName"> 类型名称 </param>
        internal static void RecordInner(LogLevel level, string name, string msg, LogType type, string typeName = null)
        {
            if (level < Level)
            {
                return;
            }
            if (type == LogType.None)
            {
                type = LogType.Message;
            }

            RecordInfos.Push(new RecordInfo
            {
                Local     = InRecording,
                RequestID = GetRequestId(),
                Machine   = GetMachineName(),
                User      = GetUserName(),
                Name      = name,
                Type      = type,
                Message   = msg,
                Time      = DateTime.Now,
                ThreadID  = Thread.CurrentThread.ManagedThreadId,
                TypeName  = typeName ?? LogEnumHelper.TypeToString(type)
            });
        }