diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 16242b98489c0d58fc5730d8180625d02d068272..0cdd0f817217b848a95866d7c063a7c7f0acda3c 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -178,4 +178,5 @@ dependencies { // elib implementation(libs.elib) + implementation(libs.telemetry) } diff --git a/app/src/main/java/foundation/e/blisslauncher/BlissLauncher.java b/app/src/main/java/foundation/e/blisslauncher/BlissLauncher.java index 12093519246a4667f40b278c29ee4f2f52662404..3ffc93e2ffb649e0699ebb1f10d68bb410d3fe2f 100755 --- a/app/src/main/java/foundation/e/blisslauncher/BlissLauncher.java +++ b/app/src/main/java/foundation/e/blisslauncher/BlissLauncher.java @@ -8,6 +8,10 @@ import android.database.ContentObserver; import android.net.Uri; import android.os.Handler; import android.provider.Settings; +import android.util.Log; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import foundation.e.blisslauncher.core.DeviceProfile; import foundation.e.blisslauncher.core.IconsHandler; @@ -15,6 +19,7 @@ import foundation.e.blisslauncher.core.blur.BlurWallpaperProvider; import foundation.e.blisslauncher.core.customviews.WidgetHost; import foundation.e.blisslauncher.features.launcher.AppProvider; import foundation.e.blisslauncher.features.notification.NotificationService; +import foundation.e.lib.telemetry.Telemetry; import timber.log.Timber; public class BlissLauncher extends Application { @@ -46,7 +51,20 @@ public class BlissLauncher extends Application { }; getContentResolver().registerContentObserver(NOTIFICATION_BADGING_URI, false, notificationSettingsObserver); - Timber.plant(new Timber.DebugTree()); + if (!BuildConfig.DEBUG) { + Telemetry.INSTANCE.init(BuildConfig.SENTRY_DSN, this); + Timber.plant(new Timber.Tree() { + @Override + protected void log(int priority, @Nullable String tag, @NonNull String message, @Nullable Throwable t) { + Log.println(priority, tag, message); + if (priority == Log.WARN || priority == Log.ERROR) { + Telemetry.INSTANCE.reportMessage(tag + ": " + message); + } + } + }); + } else { + Timber.plant(new Timber.DebugTree()); + } } private void onNotificationSettingsChanged() {