|
40 | 40 | import io.sentry.SentryExecutorService; |
41 | 41 | import io.sentry.SentryLevel; |
42 | 42 | import io.sentry.SentryOptions; |
43 | | -import io.sentry.android.core.AndroidLogger; |
44 | 43 | import io.sentry.android.core.AndroidProfiler; |
45 | 44 | import io.sentry.android.core.BuildInfoProvider; |
46 | 45 | import io.sentry.android.core.InternalSentrySdk; |
@@ -87,7 +86,8 @@ public class RNSentryModuleImpl { |
87 | 86 |
|
88 | 87 | public static final String NAME = "RNSentry"; |
89 | 88 |
|
90 | | - private static final ILogger logger = new AndroidLogger(NAME); |
| 89 | + private static final RNSentryLogger rnLogger = new RNSentryLogger(); |
| 90 | + private static final ILogger logger = rnLogger; |
91 | 91 | private static final BuildInfoProvider buildInfo = new BuildInfoProvider(logger); |
92 | 92 | private static final String modulesPath = "modules.json"; |
93 | 93 | private static final Charset UTF_8 = Charset.forName("UTF-8"); // NOPMD - Allow using UTF-8 |
@@ -170,8 +170,17 @@ public void initNativeReactNavigationNewFrameTracking(Promise promise) { |
170 | 170 | } |
171 | 171 |
|
172 | 172 | public void initNativeSdk(final ReadableMap rnOptions, Promise promise) { |
| 173 | + // Set the React context for the logger so it can forward logs to JS |
| 174 | + rnLogger.setReactContext(this.reactApplicationContext); |
| 175 | + |
173 | 176 | RNSentryStart.startWithOptions( |
174 | | - getApplicationContext(), rnOptions, getCurrentActivity(), logger); |
| 177 | + getApplicationContext(), |
| 178 | + rnOptions, |
| 179 | + options -> { |
| 180 | + // Use our custom logger that forwards to JS |
| 181 | + options.setLogger(rnLogger); |
| 182 | + }, |
| 183 | + logger); |
175 | 184 |
|
176 | 185 | promise.resolve(true); |
177 | 186 | } |
|
0 commit comments