39 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace Assets.Scripts.Scenes
{
public abstract class BaseScene: MonoBehaviour
{
protected virtual void Awake()
{
Debug.Log("base scene awake");
Application.logMessageReceived += Application_logMessageReceived;
}
private void Application_logMessageReceived(string condition, string stackTrace, LogType type)
{
//Debug.Log("application log");
if (type == LogType.Error || type == LogType.Exception)
{
string log = $"time:{ System.DateTime.Now.ToString() }\r\n";
log += $"type:{ type }\r\n";
log += $"msg:{ condition }\r\n";
log += $"stack trace:{ stackTrace }\r\n";
System.IO.File.AppendAllText($"{PFConstants.LogFolder}\\{ System.DateTime.Now.ToString("yyyy-MM-dd") }.txt", log);
//Debug.Log(PFConstants.LogFolder);
}
}
private void OnApplicationQuit()
{
App.MainDeviceAdapter.Dispose();
}
}
}