Possible to suppress "Running main with ..." message?

  1. SDK Version: 40.0.0
  2. Platforms(Android/iOS/web/all): Android/iOS

When my app starts up in prod, it console logs this huge message:

Running “main” with …

It’s super long. It gets captured as a breadcrumb to Sentry. I was hoping to not log this during prod, is it possible to prevent this log?

this comes from native code internal to react-native: react-native/RCTRootView.m at 9f69c922cbfcd08bbdfa16c36bd57153d77b9b1b · facebook/react-native · GitHub

maybe sentry lets you set up a rule to ignore it? you could ask sentry

Ohh. Thanks for the fast reply.

For now yeah I used Sentry beforeBreadcrumb to silence it, but just thought it would be nice to avoid my whole app.json getting logged, it is massive.

    beforeBreadcrumb(breadcrumb, _hint) {
      // overwrite the breadcrumb to truncate the massive console log on app start
      try {
        if (
          breadcrumb.category === 'console' &&
          breadcrumb.message?.startsWith?.('Running "main" with')
        ) {
          breadcrumb = {
            ...breadcrumb,
            message: 'Running "main" with [truncated]',
            data: {
              ...breadcrumb.data,
              arguments: ['Running "main" with [truncated]']
            }
          };
        }
      } catch (ignore) {
        // try-catch till i see this working in prod
      }

      return breadcrumb;
    },
1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.