@@ -77,6 +77,10 @@ export class Sentry {
7777 return Sentry ;
7878 }
7979
80+ static crash = ( ) => {
81+ Sentry . _client . crash ( ) ;
82+ }
83+
8084 static nativeCrash = ( ) => {
8185 Sentry . _client . nativeCrash ( ) ;
8286 }
@@ -96,6 +100,27 @@ export class Sentry {
96100 static captureMessage = ( message , options ) => {
97101 Sentry . _client . captureMessage ( message , options ) ;
98102 }
103+
104+ static log = ( level , message ) => {
105+ if ( Sentry . _options && Sentry . _options . logLevel ) {
106+ if ( Sentry . _options . logLevel < level ) {
107+ return ;
108+ }
109+ switch ( level ) {
110+ case SentryLog . Error :
111+ console . error ( message ) ;
112+ break ;
113+ case SentryLog . Debug :
114+ console . debug ( message ) ;
115+ break ;
116+ case SentryLog . Verbose :
117+ console . log ( message ) ;
118+ break ;
119+ default :
120+ return
121+ }
122+ }
123+ }
99124}
100125
101126class NativeClient {
@@ -131,23 +156,33 @@ class NativeClient {
131156 }
132157 }
133158
159+ crash = ( ) => {
160+ Sentry . log ( SentryLog . Debug , 'Sentry: NativeClient: call crash' ) ;
161+ throw new Error ( 'Sentry: NativeClient: TEST crash' ) ;
162+ }
163+
134164 nativeCrash = ( ) => {
165+ Sentry . log ( SentryLog . Debug , 'Sentry: NativeClient: call nativeCrash' ) ;
135166 RNSentry . crash ( ) ;
136167 }
137168
138169 setUserContext = ( user ) => {
170+ Sentry . log ( SentryLog . Debug , [ 'Sentry: NativeClient: call setUserContext' , user ] ) ;
139171 RNSentry . setUser ( user ) ;
140172 }
141173
142174 setTagsContext = ( tags ) => {
175+ Sentry . log ( SentryLog . Debug , [ 'Sentry: NativeClient: call setTagsContext' , tags ] ) ;
143176 RNSentry . setTags ( tags ) ;
144177 }
145178
146179 setExtraContext = ( extras ) => {
180+ Sentry . log ( SentryLog . Debug , [ 'Sentry: NativeClient: call setExtraContext' , extras ] ) ;
147181 RNSentry . setExtras ( extras ) ;
148182 }
149183
150184 captureMessage = ( message , options ) => {
185+ Sentry . log ( SentryLog . Debug , [ 'Sentry: NativeClient: call captureMessage' , message , options ] ) ;
151186 if ( options === undefined ) {
152187 options = {
153188 level : SentrySeverity . Error
@@ -157,6 +192,7 @@ class NativeClient {
157192 }
158193
159194 _activateStacktraceMerging = async ( ) => {
195+ Sentry . log ( SentryLog . Debug , 'Sentry: NativeClient: call _activateStacktraceMerging' ) ;
160196 return RNSentry . activateStacktraceMerging ( ) . then ( activated => {
161197 if ( this . _activatedMerging ) {
162198 return ;
@@ -165,7 +201,7 @@ class NativeClient {
165201 __fbBatchedBridgeConfig . remoteModuleConfig . forEach ( ( module , moduleID ) => {
166202 if ( module !== null &&
167203 this . _ignoreModulesExclude . indexOf ( module [ 0 ] ) == - 1 &&
168- ( DEFAULT_MODULE_IGNORES . indexOf ( module [ 0 ] ) >= 0 ||
204+ ( DEFAULT_MODULE_IGNORES . indexOf ( module [ 0 ] ) >= 0 ||
169205 this . _ignoreModulesInclude . indexOf ( module [ 0 ] ) >= 0 ) ) {
170206 this . _ignoredModules [ moduleID ] = true ;
171207 }
@@ -183,7 +219,9 @@ class NativeClient {
183219 if ( that . _ignoredModules [ moduleID ] ) {
184220 return original . apply ( this , arguments ) ;
185221 }
186- params . push ( { '__sentry_stack' : new Error ( ) . stack } ) ;
222+ params . push ( {
223+ '__sentry_stack' : new Error ( ) . stack
224+ } ) ;
187225 return original . apply ( this , arguments ) ;
188226 }
189227 }
@@ -205,24 +243,33 @@ class RavenClient {
205243 Raven . config ( dsn , options ) . install ( ) ;
206244 }
207245
246+ crash = ( ) => {
247+ Sentry . log ( SentryLog . Debug , 'Sentry: RavenClient: call crash' ) ;
248+ throw new Error ( "Sentry: RavenClient: TEST crash" ) ;
249+ }
250+
208251 nativeCrash = ( ) => {
209252 /*eslint no-console:0*/
210253 window . console && console . error && console . error ( "nativeCrash is not support with the RavenClient" ) ;
211254 }
212255
213256 setUserContext = ( user ) => {
257+ Sentry . log ( SentryLog . Debug , [ 'Sentry: RavenClient: call setUserContext' , user ] ) ;
214258 Raven . setUserContext ( user ) ;
215259 }
216260
217261 setTagsContext = ( tags ) => {
262+ Sentry . log ( SentryLog . Debug , [ 'Sentry: RavenClient: call setTagsContext' , tags ] ) ;
218263 Raven . setTagsContext ( tags ) ;
219264 }
220265
221266 setExtraContext = ( extras ) => {
267+ Sentry . log ( SentryLog . Debug , [ 'Sentry: RavenClient: call setExtraContext' , extras ] ) ;
222268 Raven . setExtraContext ( extras )
223269 }
224270
225271 captureMessage = async ( message , options ) => {
272+ Sentry . log ( SentryLog . Debug , [ 'Sentry: RavenClient: call captureMessage' , message , options ] ) ;
226273 if ( options && options . level ) {
227274 switch ( options . level ) {
228275 case SentrySeverity . Warning :
0 commit comments