From 5d4c58cbddaf9d456ea0628f463ec1aab63d34cb Mon Sep 17 00:00:00 2001 From: Salma ElTarzi Date: Mon, 18 Sep 2017 15:44:39 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Report=20console=20logs=20with=20lo?= =?UTF-8?q?g=20levels.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ios/RNInstabug/InstabugReactBridge.m | 36 ++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/ios/RNInstabug/InstabugReactBridge.m b/ios/RNInstabug/InstabugReactBridge.m index d80f79b..6b002d7 100644 --- a/ios/RNInstabug/InstabugReactBridge.m +++ b/ios/RNInstabug/InstabugReactBridge.m @@ -355,25 +355,25 @@ RCT_EXPORT_METHOD(isRunningLive:(RCTResponseSenderBlock)callback) { @"invocationEventTwoFingersSwipeLeft": @(IBGInvocationEventTwoFingersSwipeLeft), @"invocationEventRightEdgePan": @(IBGInvocationEventRightEdgePan), @"invocationEventFloatingButton": @(IBGInvocationEventFloatingButton), - + @"invocationModeNA": @(IBGInvocationModeNA), @"invocationModeNewBug": @(IBGInvocationModeNewBug), @"invocationModeNewFeedback": @(IBGInvocationModeNewFeedback), @"invocationModeNewChat": @(IBGInvocationModeNewChat), @"invocationModeChatsList": @(IBGInvocationModeChatsList), - + @"dismissTypeSubmit": @(IBGDismissTypeSubmit), @"dismissTypeCancel": @(IBGDismissTypeCancel), @"dismissTypeAddAtttachment": @(IBGDismissTypeAddAttachment), - + @"reportTypeBug": @(IBGReportTypeBug), @"reportTypeFeedback": @(IBGReportTypeFeedback), - + @"rectMinXEdge": @(CGRectMinXEdge), @"rectMinYEdge": @(CGRectMinYEdge), @"rectMaxXEdge": @(CGRectMaxXEdge), @"rectMaxYEdge": @(CGRectMaxYEdge), - + @"localeArabic": @(IBGLocaleArabic), @"localeChineseSimplified": @(IBGLocaleChineseSimplified), @"localeChineseTraditional": @(IBGLocaleChineseTraditional), @@ -391,10 +391,10 @@ RCT_EXPORT_METHOD(isRunningLive:(RCTResponseSenderBlock)callback) { @"localeSpanish": @(IBGLocaleSpanish), @"localeSwedish": @(IBGLocaleSwedish), @"localeTurkish": @(IBGLocaleTurkish), - + @"colorThemeLight": @(IBGColorThemeLight), @"colorThemeDark": @(IBGColorThemeDark), - + @"shakeHint": @(IBGStringShakeHint), @"swipeHint": @(IBGStringSwipeHint), @"edgeSwipeStartHint": @(IBGStringEdgeSwipeStartHint), @@ -452,10 +452,26 @@ RCTLogFunction InstabugReactLogFunction = ^( { NSString *log = RCTFormatLog([NSDate date], level, fileName, lineNumber, message); NSString *compeleteLog = [NSString stringWithFormat:@"Instabug - REACT LOG: %@", log]; - + va_list arg_list; - - IBGNSLog(compeleteLog, arg_list); + + switch(level) { + case RCTLogLevelTrace: + IBGNSLogWithLevel(compeleteLog, arg_list, IBGLogLevelTrace); + break; + case RCTLogLevelInfo: + IBGNSLogWithLevel(compeleteLog, arg_list, IBGLogLevelInfo); + break; + case RCTLogLevelWarning: + IBGNSLogWithLevel(compeleteLog, arg_list, IBGLogLevelWarning); + break; + case RCTLogLevelError: + IBGNSLogWithLevel(compeleteLog, arg_list, IBGLogLevelError); + break; + case RCTLogLevelFatal: + IBGNSLogWithLevel(compeleteLog, arg_list, IBGLogLevelFatal); + break; + } }; @end