/// <summary> /// 添加系统日志 /// </summary> /// <returns></returns> protected void AddSysLog(string optType, string optContent, string system, string module, string otherMsg = "") { Type t = this.GetType(); FuncMsgAttribute funcMsg = (FuncMsgAttribute)Attribute.GetCustomAttribute(t, typeof(FuncMsgAttribute)); BaseSysLogModel sysLogModel = new BaseSysLogModel(); sysLogModel.F_OptType = optType; sysLogModel.F_OptContent = optContent; sysLogModel.F_OtherMsg = otherMsg; try { sysLogModel.F_System = string.IsNullOrEmpty(system) ? Configs.GetSetting("systemFlag") : system; if (string.IsNullOrEmpty(module) && funcMsg != null) { sysLogModel.F_Module = funcMsg.GetModuleFuncStr(); } else { sysLogModel.F_Module = module; } SysLogProvider.GetInstance().WirteSysLog(sysLogModel); } catch (Exception e) { MyLog.Error("批量写入日志出现错误", e); } }
/// <summary> /// 添加系统日志 /// </summary> /// <returns></returns> protected void AddSysLog(string optType, string optContent, string otherMsg = "") { Type t = this.GetType(); FuncMsgAttribute funcMsg = (FuncMsgAttribute)Attribute.GetCustomAttribute(t, typeof(FuncMsgAttribute)); BaseSysLogModel sysLogModel = new BaseSysLogModel(); sysLogModel.F_OptType = optType; sysLogModel.F_OptContent = optContent; sysLogModel.F_OtherMsg = otherMsg; try { sysLogModel.F_System = Configs.GetSetting("systemFlag"); if (funcMsg == null) { sysLogModel.F_Module = ""; MyLog.Error("未配置该方法的FuncMsg信息:" + t.FullName); } else { sysLogModel.F_Module = funcMsg.GetModuleFuncStr(); } SysLogProvider.GetInstance().WirteSysLog(sysLogModel); } catch (Exception e) { MyLog.Error("写入日志出现错误", e); } }