示例#1
0
        public static void WriteLog(LoggingSessionInfo currentUserInfo, string ifName, ReqData ReqContent,
                                    Default.LowerRespData respObj, string specialParams)
        {
            try
            {
                if (ReqContent == null)
                {
                    ReqContent        = new ReqData();
                    ReqContent.common = new ReqCommonData();
                }
                SysVisitLogsBLL    logService = new SysVisitLogsBLL(currentUserInfo);
                SysVisitLogsEntity logObj     = new SysVisitLogsEntity();
                logObj.LogsID      = CPOS.Common.Utils.NewGuid();
                logObj.Locale      = ReqContent.common.locale;
                logObj.UserID      = ReqContent.common.userId;
                logObj.SessionID   = ReqContent.common.sessionId;
                logObj.Version     = ReqContent.common.version;
                logObj.Plat        = ReqContent.common.plat;
                logObj.DeviceToken = ReqContent.common.deviceToken;
                logObj.OSInfo      = ReqContent.common.osInfo;
                logObj.ChannelId   = ReqContent.common.channel;
                logObj.WeiXinId    = ReqContent.common.weiXinId;
                logObj.OpenId      = ReqContent.common.openId;

                logObj.LogType           = ifName;
                logObj.ResultCode        = respObj.code;
                logObj.ResultDescription = respObj.description;
                logObj.SpecialParams     = specialParams;

                logObj.IpAddress = GetClientIP();

                if (logObj.UserID == null)
                {
                    logObj.UserID = currentUserInfo.UserID;
                }
                if (logObj.UserID == null)
                {
                    logObj.UserID = "1";
                }

                logService.Create(logObj);
            }
            catch (Exception ex)
            {
                respObj.exception = "日志写入错误: ";//+ ex.ToString()
                Loggers.Debug(new DebugLogInfo()
                {
                    Message = ifName + " " + respObj.exception
                });
            }
        }
示例#2
0
 public static void WriteLog(LoggingSessionInfo currentUserInfo, string ifName, ReqData ReqContent,
                             Default.LowerRespData respObj)
 {
     WriteLog(currentUserInfo, ifName, ReqContent, respObj, null);
 }