public static void LogError(string logMessage, bool showLogOutput = true) { if (!AppLog._isInited) { AppLog.Init(true); } if (showLogOutput) { Debug.LogError(logMessage); } if (AppLog._writeToFile) { AppLog._fileWriter.WriteToFile(AppLog._currentFilePath, string.Format("{0}: ERROR: {1}", DateTime.UtcNow, logMessage)); } }
public static void LogException(Exception exception, bool showLogOutput = true) { if (!AppLog._isInited) { AppLog.Init(true); } if (showLogOutput) { Debug.LogException(exception); } if (AppLog._writeToFile) { string str = string.Format("{0}: EXCEPTION: {1}. {2}\nSTACK TRACE:\n{3}", new object[] { DateTime.UtcNow, exception.GetType().Name, exception.Message, exception.StackTrace }); for (Exception i = exception.InnerException; i != null; i = i.InnerException) { str = string.Concat(str, string.Format("\nINNER: {0}. {1}\nSTACK TRACE: \n{2}", i.GetType().Name, i.Message, i.StackTrace)); } AppLog._fileWriter.WriteToFile(AppLog._currentFilePath, str); } }
public Logger() { AppLog.Init(true); }