#Issues with Enabling Logging for React Native

20 messages · Page 1 of 1 (latest)

solar bluff
#

I know RN is in the works, but not entirely sure what the status is for it.
All I've been able to put together is wrapping the Sentry.captureMessage method as one of the severity types, but it will show as an issue rather than display in the Log tab. Is this the only way to do it right now?

I've tried to enable

_experiments: {
            enableLogs: true, // Enable logging
        },
        transportOptions: {
            severity: "debug", // Set the default severity level for logs
            SENTRY: Sentry,
            errorLevels: "error", // Logs with this level will be sent as errors
        }

and use Sentry.logger.info but nothing seems to be working.

storm badger
#

in standard react In the code i want to track i also put the additional capture of

const { logger } = Sentry;
logger.error(logger.fmtim a big dumb error');

does this work ?

humble isle
#

We just released a 7.0.0-beta.1 that should include the logging support

#

documentation will be released soon

#

In short you shold enable it in experiments

Sentry.init({
  // other options...
  _experiments: {
    enableLogs: true,
  },
});

And you can log it with the logger exported by @sentry/react native

import * as Sentry from '@sentry/react-native';

Sentry.logger.info('info log');
solar bluff
#

yesss thank you so much @humble isle Updating to 7beta worked.

livid heron
#

Hi @humble isle I tried the react native logs , it's working for Android, but not for iOS, is this normal?

humble isle
#

On iOS at the moment it only captures logs that comes from JavaScript

livid heron
humble isle
#

I see, thank you for the snippet!
Would you be able to open a github issue? it's ok if not

livid heron
#

Do you have suggestion for iOS logging? @humble isle

humble isle
#

for native iOS logs we are still working on it

livid heron
#

@humble isle yeah it's working. The current solution right now is sending custom event from iOS native module to JS

livid heron
#

Hi @humble isle is this feature already available in iOS? Thanks 🙂

humble isle
#

not yet, but we are planning on enabling it soon

livid heron
livid heron
#

My idea is to access the logger from Swift side

humble isle
#

correct, at the moment, the React Native SDK doesn't automatically intialize the iOS logs