コード例 #1
0
 /// <summary>
 /// 记录接口日志
 /// </summary>
 /// <param name="model"></param>
 public void WriteInterfaceServiceLog(InterfaceLogInfoProxy model)
 {
     if (_interfaceLog != null && _interfaceLog.IsInfoEnabled)
     {
         _interfaceLog.Info(model);
     }
 }
コード例 #2
0
        /// <summary>
        /// 接口异常日志
        /// </summary>
        /// <param name="outSysCode"></param>
        /// <param name="type"></param>
        /// <param name="level"></param>
        /// <param name="ex"></param>
        public void LogIOServiceLog(string outSysCode, IOEventType type, EventLevel level, Exception ex)
        {
            try
            {
                if (!string.IsNullOrWhiteSpace(outSysCode))
                {
                    InterfaceLogInfoProxy info = new InterfaceLogInfoProxy
                    {
                        CreateTime       = DateTime.Now,
                        Creator          = "MES System",
                        EventDescription = ex.StackTrace,
                        EventLevel       = level.ToString(),
                        EventName        = ex.Message,
                        EventType        = type.ToString(),
                        LogID            = Guid.NewGuid(),
                        OutSysCode       = Guid.Parse(outSysCode)
                    };

                    WriteInterfaceServiceLog(info);
                }
            }
            catch (Exception exNew)
            {
                this.LogError(null, null, string.Empty, level, exNew);
                throw;
            }
        }