diff --git a/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.cs b/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.cs
index 842249f..a9d01a2 100644
--- a/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.cs
+++ b/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.cs
@@ -15,6 +15,7 @@ namespace Guru
public static void InitFirebase(Action callback, bool isDebug = false)
{
_isDebug = isDebug;
+ GuruRepoter.Install();
FirebaseApp.CheckAndFixDependenciesAsync().ContinueWithOnMainThread(task => {
DependencyStatus = task.Result;
if (DependencyStatus == DependencyStatus.Available)
diff --git a/Runtime/GuruCore/Runtime/Reporter.meta b/Runtime/GuruCore/Runtime/Reporter.meta
new file mode 100644
index 0000000..3461966
--- /dev/null
+++ b/Runtime/GuruCore/Runtime/Reporter.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 9807dc50fb0f4127adc07b053dc5eac5
+timeCreated: 1707044916
\ No newline at end of file
diff --git a/Runtime/GuruCore/Runtime/Reporter/GuruRepoter.cs b/Runtime/GuruCore/Runtime/Reporter/GuruRepoter.cs
new file mode 100644
index 0000000..2cad3f7
--- /dev/null
+++ b/Runtime/GuruCore/Runtime/Reporter/GuruRepoter.cs
@@ -0,0 +1,91 @@
+namespace Guru
+{
+ using System.Collections.Generic;
+ using UnityEngine;
+ using Firebase.Crashlytics;
+ using System;
+ using System.Linq;
+
+ public class GuruRepoter
+ {
+ private static bool _isReady;
+
+ ///
+ /// 捕获列表
+ ///
+ private static List _catchFilter = new List()
+ {
+ LogType.Exception,
+ };
+
+ ///
+ /// 上报列表
+ ///
+ private static List _logFilter = new List()
+ {
+ LogType.Error,
+ LogType.Assert,
+ };
+
+ public static void Install()
+ {
+ _isReady = true;
+ Crashlytics.IsCrashlyticsCollectionEnabled = true;
+
+ Application.logMessageReceived += OnReceivedMessage;
+ Application.logMessageReceivedThreaded += OnReceivedMessage;
+ }
+
+ private static void CheckReady()
+ {
+ if (_isReady) return;
+ Install();
+ }
+
+
+ private static string ToLogTypeString(LogType type)
+ {
+ switch (type)
+ {
+ case LogType.Exception: return "ex";
+ case LogType.Error: return "e";
+ case LogType.Warning: return "w";
+ }
+ return "i";
+ }
+
+
+ private static void OnReceivedMessage(string condition, string stackTrace, LogType type)
+ {
+
+ string msg = $"{DateTime.Now:yy-MM-dd HH:mm:ss} [{ToLogTypeString(type)}] {condition}\n{stackTrace}";
+
+ if (_catchFilter.Contains(type))
+ {
+ LogException(msg);
+ }
+ else if(_logFilter.Contains(type))
+ {
+ Log(msg);
+ }
+ }
+
+ public static void LogException(Exception ex)
+ {
+ CheckReady();
+ Crashlytics.LogException(ex);
+ }
+
+ public static void LogException(string msg)
+ {
+ CheckReady();
+ Crashlytics.LogException(new Exception(msg));
+ }
+
+ public static void Log(string msg)
+ {
+ CheckReady();
+ Crashlytics.Log(msg);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/GuruCore/Runtime/Reporter/GuruRepoter.cs.meta b/Runtime/GuruCore/Runtime/Reporter/GuruRepoter.cs.meta
new file mode 100644
index 0000000..b30a3b0
--- /dev/null
+++ b/Runtime/GuruCore/Runtime/Reporter/GuruRepoter.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 99041f4e2a234d89b79af4a0d23514d2
+timeCreated: 1707038494
\ No newline at end of file