@@ -77,6 +77,10 @@ export class Sentry {
77
77
return Sentry ;
78
78
}
79
79
80
+ static crash = ( ) => {
81
+ Sentry . _client . crash ( ) ;
82
+ }
83
+
80
84
static nativeCrash = ( ) => {
81
85
Sentry . _client . nativeCrash ( ) ;
82
86
}
@@ -96,6 +100,27 @@ export class Sentry {
96
100
static captureMessage = ( message , options ) => {
97
101
Sentry . _client . captureMessage ( message , options ) ;
98
102
}
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
+ }
99
124
}
100
125
101
126
class NativeClient {
@@ -131,23 +156,33 @@ class NativeClient {
131
156
}
132
157
}
133
158
159
+ crash = ( ) => {
160
+ Sentry . log ( SentryLog . Debug , 'Sentry: NativeClient: call crash' ) ;
161
+ throw new Error ( 'Sentry: NativeClient: TEST crash' ) ;
162
+ }
163
+
134
164
nativeCrash = ( ) => {
165
+ Sentry . log ( SentryLog . Debug , 'Sentry: NativeClient: call nativeCrash' ) ;
135
166
RNSentry . crash ( ) ;
136
167
}
137
168
138
169
setUserContext = ( user ) => {
170
+ Sentry . log ( SentryLog . Debug , [ 'Sentry: NativeClient: call setUserContext' , user ] ) ;
139
171
RNSentry . setUser ( user ) ;
140
172
}
141
173
142
174
setTagsContext = ( tags ) => {
175
+ Sentry . log ( SentryLog . Debug , [ 'Sentry: NativeClient: call setTagsContext' , tags ] ) ;
143
176
RNSentry . setTags ( tags ) ;
144
177
}
145
178
146
179
setExtraContext = ( extras ) => {
180
+ Sentry . log ( SentryLog . Debug , [ 'Sentry: NativeClient: call setExtraContext' , extras ] ) ;
147
181
RNSentry . setExtras ( extras ) ;
148
182
}
149
183
150
184
captureMessage = ( message , options ) => {
185
+ Sentry . log ( SentryLog . Debug , [ 'Sentry: NativeClient: call captureMessage' , message , options ] ) ;
151
186
if ( options === undefined ) {
152
187
options = {
153
188
level : SentrySeverity . Error
@@ -157,6 +192,7 @@ class NativeClient {
157
192
}
158
193
159
194
_activateStacktraceMerging = async ( ) => {
195
+ Sentry . log ( SentryLog . Debug , 'Sentry: NativeClient: call _activateStacktraceMerging' ) ;
160
196
return RNSentry . activateStacktraceMerging ( ) . then ( activated => {
161
197
if ( this . _activatedMerging ) {
162
198
return ;
@@ -165,7 +201,7 @@ class NativeClient {
165
201
__fbBatchedBridgeConfig . remoteModuleConfig . forEach ( ( module , moduleID ) => {
166
202
if ( module !== null &&
167
203
this . _ignoreModulesExclude . indexOf ( module [ 0 ] ) == - 1 &&
168
- ( DEFAULT_MODULE_IGNORES . indexOf ( module [ 0 ] ) >= 0 ||
204
+ ( DEFAULT_MODULE_IGNORES . indexOf ( module [ 0 ] ) >= 0 ||
169
205
this . _ignoreModulesInclude . indexOf ( module [ 0 ] ) >= 0 ) ) {
170
206
this . _ignoredModules [ moduleID ] = true ;
171
207
}
@@ -183,7 +219,9 @@ class NativeClient {
183
219
if ( that . _ignoredModules [ moduleID ] ) {
184
220
return original . apply ( this , arguments ) ;
185
221
}
186
- params . push ( { '__sentry_stack' : new Error ( ) . stack } ) ;
222
+ params . push ( {
223
+ '__sentry_stack' : new Error ( ) . stack
224
+ } ) ;
187
225
return original . apply ( this , arguments ) ;
188
226
}
189
227
}
@@ -205,24 +243,33 @@ class RavenClient {
205
243
Raven . config ( dsn , options ) . install ( ) ;
206
244
}
207
245
246
+ crash = ( ) => {
247
+ Sentry . log ( SentryLog . Debug , 'Sentry: RavenClient: call crash' ) ;
248
+ throw new Error ( "Sentry: RavenClient: TEST crash" ) ;
249
+ }
250
+
208
251
nativeCrash = ( ) => {
209
252
/*eslint no-console:0*/
210
253
window . console && console . error && console . error ( "nativeCrash is not support with the RavenClient" ) ;
211
254
}
212
255
213
256
setUserContext = ( user ) => {
257
+ Sentry . log ( SentryLog . Debug , [ 'Sentry: RavenClient: call setUserContext' , user ] ) ;
214
258
Raven . setUserContext ( user ) ;
215
259
}
216
260
217
261
setTagsContext = ( tags ) => {
262
+ Sentry . log ( SentryLog . Debug , [ 'Sentry: RavenClient: call setTagsContext' , tags ] ) ;
218
263
Raven . setTagsContext ( tags ) ;
219
264
}
220
265
221
266
setExtraContext = ( extras ) => {
267
+ Sentry . log ( SentryLog . Debug , [ 'Sentry: RavenClient: call setExtraContext' , extras ] ) ;
222
268
Raven . setExtraContext ( extras )
223
269
}
224
270
225
271
captureMessage = async ( message , options ) => {
272
+ Sentry . log ( SentryLog . Debug , [ 'Sentry: RavenClient: call captureMessage' , message , options ] ) ;
226
273
if ( options && options . level ) {
227
274
switch ( options . level ) {
228
275
case SentrySeverity . Warning :
0 commit comments