Beispiel #1
0
 /// <summary>
 /// 清除数据
 /// </summary>
 public override void OnClear()
 {
     _instance = null;
     Application.RegisterLogCallback(null);
     if (LCSConfig.IsAutoWriteToFile)
     {
         LCSLogFile.Clear();
     }
 }
Beispiel #2
0
        /// <summary>
        /// 日志堆栈回调函数
        ///
        /// 不能在输出 log 日志
        /// </summary>
        /// <param name="logString">输入的日志</param>
        /// <param name="stackTrace">堆栈数据</param>
        /// <param name="type">日志类型</param>
        private void LogCallback(string logString, string stackTrace, UnityEngine.LogType type)
        {
            switch (type)
            {
            case UnityEngine.LogType.Log:
                if (LCSConfig.IsAutoWriteToFile)
                {
                    LCSLogFile.Write(logString);
                    LCSLogFile.Write(stackTrace);
                }
                if (LCSConfig.IsAutoWriteToGui)
                {
                    LCSLogGUI.Write(logString);
                    LCSLogGUI.Write(stackTrace);
                }
                break;

            case UnityEngine.LogType.Warning:
                if (LCSConfig.IsAutoWriteToFile)
                {
                    LCSLogFile.WriteWarning(logString);
                    LCSLogFile.WriteWarning(stackTrace);
                }
                if (LCSConfig.IsAutoWriteToGui)
                {
                    LCSLogGUI.WriteWarning(logString);
                    LCSLogGUI.WriteWarning(stackTrace);
                }
                break;

            case UnityEngine.LogType.Error:
                if (LCSConfig.IsAutoWriteToFile)
                {
                    LCSLogFile.WriteError(logString);
                    LCSLogFile.WriteError(stackTrace);
                }
                if (LCSConfig.IsAutoWriteToGui)
                {
                    LCSLogGUI.WriteError(logString);
                    LCSLogGUI.WriteError(stackTrace);
                }
                break;
            }
        }