nativescript-sentry icon indicating copy to clipboard operation
nativescript-sentry copied to clipboard

Support beforeSend

Open mm-spiio opened this issue 5 years ago • 2 comments
trafficstars

Is there a way to support the beforeSend option? I don't want to log things when developing locally... Something like this:

Sentry.init(
    { dsn: "DSN", beforeSend: (event, hint) => { 
        if (IS_DEBUG) { 
            console.error(hint.originalException || hint.syntheticException || event); 
            return null; 
        } 
        return event; 
    }
}); 

mm-spiio avatar May 14 '20 10:05 mm-spiio

@mm-spiio you can transform your Sentry.init() to something like this:

!IS_DEBUG && Sentry.init(/* your options */)

TemaSM avatar May 17 '20 15:05 TemaSM

@TemaSM I don't think so. That just does not initialize Sentry if DEBUG is true. But then in the code all the "log" statements are still there and then it'd try to log them on a not-initialized sentry object.

mm-spiio avatar May 18 '20 11:05 mm-spiio