Exemple #1
0
        public static void BaseExceptionLog(BaseException ex, string typeName)
        {
            if (!Config.IsDebug)
            {
                return;
            }


            using (var traceItem = new TraceItem(_logEndAction, typeName))
            {
                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
        public static void LogError(string typeName, string content, string folder = null, string fileName = null)
        {
            string tempFolder = string.IsNullOrEmpty(folder) ? "App" : folder;

            using (var traceItem = new TraceItem(_logEndAction1, LogLevel.Error, typeName, content, tempFolder, fileName))
            {
                //traceItem.Log(content);
            }
        }
Exemple #3
0
 public static void SendApiLog(string url, string returnText)
 {
     if (!Config.IsDebug)
     {
         return;
     }
     using (var traceItem = new TraceItem(_logEndAction, "接口调用"))
     {
         traceItem.Log($"URL:{url}");
         traceItem.Log($"Result:\r\n{returnText}");
     }
 }
Exemple #4
0
        public static void SendCustomLog(string typeName, string content)
        {
            if (!Config.IsDebug)
            {
                return;
            }

            using (var traceItem = new TraceItem(_logEndAction, typeName, content))
            {
                //traceItem.Log(content);
            }
        }
Exemple #5
0
        public static void SendApiPostDataLog(string url, string data)
        {
            if (!Config.IsDebug)
            {
                return;
            }

            using (var traceItem = new TraceItem(_logEndAction, "接口调用"))
            {
                traceItem.Log($"URL:{url}");
                traceItem.Log($"Post Data:\r\n{data}");
            }
        }