少年修仙传客户端代码仓库
lwb
2021-02-25 0d7482d5a0e8bf082abfb4b5bfbfee03597cdc3a
Utility/RunTimeExceptionUtility.cs
@@ -1,19 +1,19 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using System.IO;
using System.Threading;
[XLua.LuaCallCSharp]
public class RunTimeExceptionUtility : Singleton<RunTimeExceptionUtility>
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using System.IO;
using System.Threading;
public class RunTimeExceptionUtility : Singleton<RunTimeExceptionUtility>
{
    List<string> logWriteToFileTemp = new List<string>();
    DateTime nextWriteFileTime = DateTime.Now;
    string logFileRoot = string.Empty;
    string logFileRoot = string.Empty;
    public void Init()
    {
        GlobalTimeEvent.Instance.secondEvent -= OnPerSecond;
@@ -41,19 +41,19 @@
        GlobalTimeEvent.Instance.secondEvent += OnPerSecond;
        Application.logMessageReceivedThreaded += AddLogRenderer;
    }
    }
    public void UnInit()
    {
        GlobalTimeEvent.Instance.secondEvent -= OnPerSecond;
        Application.logMessageReceivedThreaded -= AddLogRenderer;
    }
    }
    private void AddLogRenderer(string _log, string _callStack, LogType _type)
    {
        logWriteToFileTemp.Add(string.Format("{0}--{1}:Thread:{2}-{3};{4}{5}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), _type, Thread.CurrentThread.ManagedThreadId, _log, _callStack, "\r\n"));
    }
    }
    private void OnPerSecond()
    {
        if (DateTime.Now > nextWriteFileTime)
@@ -70,7 +70,7 @@
                logWriteToFileTemp.Clear();
            }
        }
    }
}
    }
}