Skip to content

Commit 5d4c58c

Browse files
committed
✨ Report console logs with log levels.
1 parent 4245764 commit 5d4c58c

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

ios/RNInstabug/InstabugReactBridge.m

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -355,25 +355,25 @@ - (NSDictionary *)constantsToExport
355355
@"invocationEventTwoFingersSwipeLeft": @(IBGInvocationEventTwoFingersSwipeLeft),
356356
@"invocationEventRightEdgePan": @(IBGInvocationEventRightEdgePan),
357357
@"invocationEventFloatingButton": @(IBGInvocationEventFloatingButton),
358-
358+
359359
@"invocationModeNA": @(IBGInvocationModeNA),
360360
@"invocationModeNewBug": @(IBGInvocationModeNewBug),
361361
@"invocationModeNewFeedback": @(IBGInvocationModeNewFeedback),
362362
@"invocationModeNewChat": @(IBGInvocationModeNewChat),
363363
@"invocationModeChatsList": @(IBGInvocationModeChatsList),
364-
364+
365365
@"dismissTypeSubmit": @(IBGDismissTypeSubmit),
366366
@"dismissTypeCancel": @(IBGDismissTypeCancel),
367367
@"dismissTypeAddAtttachment": @(IBGDismissTypeAddAttachment),
368-
368+
369369
@"reportTypeBug": @(IBGReportTypeBug),
370370
@"reportTypeFeedback": @(IBGReportTypeFeedback),
371-
371+
372372
@"rectMinXEdge": @(CGRectMinXEdge),
373373
@"rectMinYEdge": @(CGRectMinYEdge),
374374
@"rectMaxXEdge": @(CGRectMaxXEdge),
375375
@"rectMaxYEdge": @(CGRectMaxYEdge),
376-
376+
377377
@"localeArabic": @(IBGLocaleArabic),
378378
@"localeChineseSimplified": @(IBGLocaleChineseSimplified),
379379
@"localeChineseTraditional": @(IBGLocaleChineseTraditional),
@@ -391,10 +391,10 @@ - (NSDictionary *)constantsToExport
391391
@"localeSpanish": @(IBGLocaleSpanish),
392392
@"localeSwedish": @(IBGLocaleSwedish),
393393
@"localeTurkish": @(IBGLocaleTurkish),
394-
394+
395395
@"colorThemeLight": @(IBGColorThemeLight),
396396
@"colorThemeDark": @(IBGColorThemeDark),
397-
397+
398398
@"shakeHint": @(IBGStringShakeHint),
399399
@"swipeHint": @(IBGStringSwipeHint),
400400
@"edgeSwipeStartHint": @(IBGStringEdgeSwipeStartHint),
@@ -452,10 +452,26 @@ + (BOOL)iOSVersionIsLessThan:(NSString *)iOSVersion {
452452
{
453453
NSString *log = RCTFormatLog([NSDate date], level, fileName, lineNumber, message);
454454
NSString *compeleteLog = [NSString stringWithFormat:@"Instabug - REACT LOG: %@", log];
455-
455+
456456
va_list arg_list;
457-
458-
IBGNSLog(compeleteLog, arg_list);
457+
458+
switch(level) {
459+
case RCTLogLevelTrace:
460+
IBGNSLogWithLevel(compeleteLog, arg_list, IBGLogLevelTrace);
461+
break;
462+
case RCTLogLevelInfo:
463+
IBGNSLogWithLevel(compeleteLog, arg_list, IBGLogLevelInfo);
464+
break;
465+
case RCTLogLevelWarning:
466+
IBGNSLogWithLevel(compeleteLog, arg_list, IBGLogLevelWarning);
467+
break;
468+
case RCTLogLevelError:
469+
IBGNSLogWithLevel(compeleteLog, arg_list, IBGLogLevelError);
470+
break;
471+
case RCTLogLevelFatal:
472+
IBGNSLogWithLevel(compeleteLog, arg_list, IBGLogLevelFatal);
473+
break;
474+
}
459475
};
460476

461477
@end

0 commit comments

Comments
 (0)