コード例 #1
0
    public void SaveLogs()
    {
        SerializedLogs serializedLogs = new SerializedLogs();

        serializedLogs.logs = logs;

        string json = JsonUtility.ToJson(serializedLogs);
        string path = Application.persistentDataPath + "/execution-times-" + System.DateTime.Now.ToString("U") + ".log";

        Debug.Log("JSON logs path: " + path);

        using (FileStream fs = new FileStream(path, FileMode.Create))
        {
            using (StreamWriter writer = new StreamWriter(fs))
            {
                writer.Write(json);
            }
        }
    }
コード例 #2
0
 private void OnLogEntryAdded(SeverityLevel level, string message)
 {
     SerializedLogs.Add(message);
 }