private void PutLogInFile(BMSLog.Logtype type, string log) { // TODO: Need to use the isolated storage for IOS #if UNITY_IOS return; #else if (!LogToFile) { return; } lock (Mutex) { string read = string.Empty; using (System.IO.StreamReader sr = new System.IO.StreamReader(filepath)) { read = sr.ReadToEnd(); } string dlog = $"[{System.DateTime.Now.ToString()} - {type.ToString().ToUpper()}] {log}"; if (type == BMSLog.Logtype.Exception) { dlog = $"{dlog}{System.Environment.NewLine}{System.Environment.StackTrace}"; } string finalLog = $"{read}{dlog}"; using (System.IO.StreamWriter sw = new System.IO.StreamWriter(filepath)) { sw.WriteLine(finalLog); } } #endif }
private void PutLogInFile(BMSLog.Logtype type, string log) { // TODO: Need to use the isolated storage for UWP and IOS #if WINDOWS_UWP || UNITY_IOS return; #else if (!LogToFile) { return; } lock (Mutex) { string read = string.Empty; using (System.IO.StreamReader sr = new System.IO.StreamReader(filepath)) { read = sr.ReadToEnd(); } string dlog = string.Format("[{0} - {1}] {2}", System.DateTime.Now.ToString(), type.ToString().ToUpper(), log); if (type == BMSLog.Logtype.Exception) { dlog = string.Format("{0}{1}{2}", dlog, System.Environment.NewLine, System.Environment.StackTrace); } string finalLog = string.Format("{0}{1}", read, dlog); using (System.IO.StreamWriter sw = new System.IO.StreamWriter(filepath)) { sw.WriteLine(finalLog); } } #endif }