Exemple #1
0
        /// <summary>
        /// BaseException 日志
        /// </summary>
        /// <param name="ex"></param>
        public static void BaseExceptionLog(BaseException ex)
        {
            if (!Config.IsDebug)
            {
                return;
            }


            using (var traceItem = new SenparcTraceItem(_logEndActon, "BaseException"))
            {
                traceItem.Log(ex.GetType().Name);
                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 (OnBaseExceptionFunc != null)
                {
                    try
                    {
                        OnBaseExceptionFunc(ex);
                    }
                    catch
                    {
                    }
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// 自定义日志
        /// </summary>
        /// <param name="typeName">日志类型</param>
        /// <param name="content">日志内容</param>
        public static void SendCustomLog(string typeName, string content)
        {
            if (!Config.IsDebug)
            {
                return;
            }

            using (var traceItem = new SenparcTraceItem(_logEndActon, typeName, content))
            {
                //traceItem.Log(content);
            }
        }
Exemple #3
0
        /// <summary>
        /// API请求日志(Post发送消息)
        /// </summary>
        /// <param name="url"></param>
        /// <param name="data"></param>
        public static void SendApiPostDataLog(string url, string data)
        {
            if (!Config.IsDebug)
            {
                return;
            }

            using (var traceItem = new SenparcTraceItem(_logEndActon, "接口调用"))
            {
                traceItem.Log("URL:{0}", url);
                traceItem.Log("Post Data:\r\n{0}", data);
            }
        }
Exemple #4
0
        /// <summary>
        /// API请求日志(接收结果)
        /// </summary>
        /// <param name="url"></param>
        /// <param name="returnText"></param>
        public static void SendApiLog(string url, string returnText)
        {
            if (!Config.IsDebug)
            {
                return;
            }

            using (var traceItem = new SenparcTraceItem(_logEndActon, "接口调用"))
            {
                //TODO:从源头加入AppId
                traceItem.Log("URL:{0}", url);
                traceItem.Log("Result:\r\n{0}", returnText);
            }
        }