예제 #1
0
파일: WeixinTrace.cs 프로젝트: ofood/WeChat
        /// <summary>
        /// ErrorJsonResultException 日志
        /// </summary>
        /// <param name="ex"></param>
        public static void ErrorJsonResultExceptionLog(ErrorJsonResultException ex)
        {
            if (!WxConfig.IsDebug)
            {
                return;
            }

            using (var traceItem = new TraceItem(LogTrace._logEndActon, "ErrorJsonResultException"))
            {
                traceItem.Log("ErrorJsonResultException");
                traceItem.Log("AccessTokenOrAppId:{0}", ex.AccessTokenOrAppId ?? "null");
                traceItem.Log("URL:{0}", ex.Url);
                traceItem.Log("errcode:{0}", ex.JsonResult.ErrorCodeValue);
                traceItem.Log("errmsg:{0}", ex.JsonResult.errmsg);
            }

            if (OnWeixinExceptionFunc != null)
            {
                try
                {
                    OnWeixinExceptionFunc(ex);
                }
                catch
                {
                }
            }
        }
예제 #2
0
파일: WeixinTrace.cs 프로젝트: ofood/WeChat
        /// <summary>
        /// WeixinException 日志
        /// </summary>
        /// <param name="ex"></param>
        public static void WeixinExceptionLog(WeixinException ex)
        {
            if (!WxConfig.IsDebug)
            {
                return;
            }
            using (var traceItem = new TraceItem(LogTrace._logEndActon, "WeixinException"))
            {
                traceItem.Log(ex.GetType().Name);
                traceItem.Log("AccessTokenOrAppId:{0}", ex.AccessTokenOrAppId);
                traceItem.Log("Message:{0}", ex.Message);
                traceItem.Log("StackTrace:{0}", ex.StackTrace);
                if (ex.InnerException != null)
                {
                    traceItem.Log("InnerException:{0}", ex.InnerException.Message);
                    traceItem.Log("InnerException.StackTrace:{0}", ex.InnerException.StackTrace);
                }
            }

            if (OnWeixinExceptionFunc != null)
            {
                try
                {
                    OnWeixinExceptionFunc(ex);
                }
                catch
                {
                }
            }
        }