Skip to content
This repository was archived by the owner on Feb 19, 2020. It is now read-only.

Commit 6a08686

Browse files
committed
Log errors
1 parent ba7f3b6 commit 6a08686

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

Plugins/HockeyAppUnityAndroid/HockeyAppUnity-Scripts/HockeyAppAndroid.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ void Awake ()
6262
if(exceptionLogging == true && IsConnected() == true) {
6363
List<string> logFileDirs = GetLogFiles();
6464
if(logFileDirs.Count > 0) {
65+
Debug.Log("Found files: " + logFileDirs.Count);
6566
StartCoroutine(SendLogs(logFileDirs));
6667
}
6768
}
@@ -432,6 +433,9 @@ protected virtual IEnumerator SendLogs (List<string> logs)
432433
if (Debug.isDebugBuild)
433434
Debug.Log ("Failed to delete exception log: " + e);
434435
}
436+
} else {
437+
if (Debug.isDebugBuild)
438+
Debug.Log ("Crash sending error: " + www.error);
435439
}
436440
}
437441
}
@@ -517,7 +521,14 @@ protected virtual void HandleException (string logString, string stackTrace)
517521
{
518522

519523
#if (UNITY_ANDROID && !UNITY_EDITOR)
520-
WriteLogToDisk(logString, stackTrace);
524+
try
525+
{
526+
WriteLogToDisk(logString, stackTrace);
527+
}
528+
catch (Exception e)
529+
{
530+
AndroidLog(e.ToString());
531+
}
521532
#endif
522533
}
523534

@@ -575,6 +586,12 @@ private static AndroidJavaObject DictainaryToJavaMap<TKey, TValue>(IDictionary<T
575586
return javaMap;
576587
}
577588

589+
private static void AndroidLog(string message)
590+
{
591+
var logClass = new AndroidJavaObject("android.util.Log");
592+
logClass.CallStatic<int>("d", "HockeyApp", message);
593+
}
594+
578595
#endif
579596
#endregion
580597
}

0 commit comments

Comments
 (0)