public static bool CheckLogType(LogType t)
{
if (t == LogType.Error || t == LogType.Exception)
return true;
return false;
}
public static Application.LogCallback GetErrorLog(Action<string,string> func)
{
Application.LogCallback ac = new Application.LogCallback((a,b,c)=> {
if (CheckLogType(c))
{
func?.Invoke(a,b);
}
});
Application.logMessageReceived += ac;
return ac;
}
public static string GetDeviceInfo()
{
return "deviceModel:" + SystemInfo.deviceModel+ "\n"+/*设备模型*/
"deviceName:" + SystemInfo.deviceName + "\n" +/*设备名称*/
"deviceUniqueIdentifier:" + SystemInfo.deviceUniqueIdentifier + "\n" +/*设备唯一标识符*/
"copyTextureSupport:" + SystemInfo.copyTextureSupport.ToString() + "\n" +/*是否支持纹理复制*/
"graphicsDeviceID:" + SystemInfo.graphicsDeviceID.ToString() + "\n" +/*显卡ID*/
"graphicsDeviceName:" + SystemInfo.graphicsDeviceName + "\n" +/*显卡名称*/
"graphicsDeviceType:" + SystemInfo.graphicsDeviceType.ToString() + "\n" +/*显卡类型*/
"graphicsDeviceVendor:" + SystemInfo.graphicsDeviceVendor + "\n" +/*显卡供应商*/
"graphicsDeviceVendorID:" + SystemInfo.graphicsDeviceVendorID.ToString() + "\n" +/*显卡供应商ID*/
"graphicsDeviceVersion:" + SystemInfo.graphicsDeviceVersion + "\n" +/*显卡版本号*/
"graphicsMemorySize:" + SystemInfo.graphicsMemorySize + "\n" +/*显存大小(单位:MB)*/
"graphicsMultiThreaded:" + SystemInfo.graphicsMultiThreaded.ToString() + "\n" +/*显卡是否支持多线程渲染*/
"supportedRenderTargetCount:" + SystemInfo.supportedRenderTargetCount.ToString() + "\n" +/*支持的渲染目标数量*/
"systemMemorySize:" + SystemInfo.systemMemorySize.ToString() + "\n" +/*系统内存大小(单位:MB):*/
"operatingSystem:" + SystemInfo.operatingSystem + "\n"+"curTime:"+GetTimers()+"\n";/*操作系统 当前时间*/
}
public static string GetTimers()
{
return DateTime.Now.ToString();
}
public static void RemoveLog(Application.LogCallback ac)
{
if (ac != null)
Application.logMessageReceived -= ac;
}
Unity 获取错误日志信息
最新推荐文章于 2024-04-25 09:52:27 发布