Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions sentry-android/src/main/java/com/joshdholtz/sentry/Sentry.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public class Sentry {
private SentryEventCaptureListener captureListener;
private JSONObject contexts = new JSONObject();
private Executor executor;
private boolean disableOnDebug;
final Breadcrumbs breadcrumbs = new Breadcrumbs();

public enum SentryEventLevel {
Expand Down Expand Up @@ -111,14 +112,19 @@ static class LazyHolder {
static final Sentry instance = new Sentry();
}

public static void init(Context context, String dsn, boolean disableOnDebug) {
init(context, dsn, true, disableOnDebug);
}

public static void init(Context context, String dsn) {
init(context, dsn, true);
init(context, dsn, true, false);
}

public static void init(Context context, String dsn, boolean setupUncaughtExceptionHandler) {
public static void init(Context context, String dsn, boolean setupUncaughtExceptionHandler, boolean disableOnDebug) {
final Sentry sentry = Sentry.getInstance();

sentry.context = context.getApplicationContext();
sentry.disableOnDebug = disableOnDebug && BuildConfig.DEBUG;

Uri uri = Uri.parse(dsn);
String port = "";
Expand Down Expand Up @@ -419,7 +425,9 @@ private static void doCaptureEventPost(final SentryEventRequest request) {
return;
}

sentry.executor.execute(sentry.makePoster(request));
if (!sentry.disableOnDebug) {
sentry.executor.execute(sentry.makePoster(request));
}
}

private static class SentryUncaughtExceptionHandler implements UncaughtExceptionHandler {
Expand Down