Skip to content
This repository was archived by the owner on Aug 30, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion sentry-sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<!-- <meta-data android:name="io.sentry.anr.enable" android:value="false" />-->

<!-- how to disable the auto-init-->
<!-- <meta-data android:name="io.sentry.auto-init" android:value="false" />-->
<meta-data android:name="io.sentry.auto-init" android:value="false" />

<!-- how to disable the NDK-->
<!-- <meta-data android:name="io.sentry.ndk.enable" android:value="false" />-->
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package io.sentry.core.transport;

import io.sentry.core.ISerializer;
import io.sentry.core.SentryEvent;
import java.io.IOException;
import java.io.PrintWriter;

public final class StdoutTransport implements ITransport {

private final ISerializer serializer;

public StdoutTransport(final ISerializer serializer) {
this.serializer = serializer;
}

@Override
public TransportResult send(SentryEvent event) throws IOException {
PrintWriter writer = new PrintWriter(System.out);
serializer.serialize(event, writer);

return TransportResult.success();
}

@Override
public void close() throws IOException {}
}
17 changes: 9 additions & 8 deletions sentry-sample/src/main/java/io/sentry/sample/MyApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import android.app.Application;
import android.os.StrictMode;
import io.sentry.android.core.SentryAndroid;
import io.sentry.core.transport.StdoutTransport;
import timber.log.Timber;

// import io.sentry.android.core.SentryAndroid;
Expand All @@ -18,14 +20,13 @@ public void onCreate() {

// Example how to initialize the SDK manually which allows access to SentryOptions callbacks.
// Make sure you disable the auto init via manifest meta-data: io.sentry.auto-init=false
// SentryAndroid.init(
// this,
// options -> {
// options.setBeforeSend(event -> {
// event.setTag("sample-key", "before-send");
// });
// options.setAnrTimeoutIntervalMills(2000);
// });
SentryAndroid.init(
this,
options -> {
if (BuildConfig.DEBUG) {
options.setTransport(new StdoutTransport(options.getSerializer()));
}
});
}

private void strictMode() {
Expand Down