From dac62da2c203daf84563a7bbe50558c7fb0310be Mon Sep 17 00:00:00 2001 From: Nipun Singh <88689850+nsingh-branch@users.noreply.github.com> Date: Fri, 8 Mar 2024 11:43:46 -0800 Subject: [PATCH] Updated logging (#32) --- .../Classes/AdobeBranchExtensionClass.m | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/AdobeBranchExtension/Classes/AdobeBranchExtensionClass.m b/AdobeBranchExtension/Classes/AdobeBranchExtensionClass.m index 4c0a702..6f7e7be 100644 --- a/AdobeBranchExtension/Classes/AdobeBranchExtensionClass.m +++ b/AdobeBranchExtension/Classes/AdobeBranchExtensionClass.m @@ -9,7 +9,7 @@ #import "AdobeBranchExtension.h" #import "AdobeBranchExtensionConfig.h" #import -#import +#import #import #import @@ -70,9 +70,8 @@ - (nullable instancetype)initWithRuntime:(id _Nonnull)runti } - (void)onRegistered { - BNCLogDebug(@"AdobeBranchExtension listener registered"); + [[BranchLogger shared] logDebug:@"AdobeBranchExtension listener registered"]; - BNCLogSetDisplayLevel(BNCLogLevelAll); [self deviceDataSharedState: NULL]; [runtime_ registerListenerWithType:AEPEventType.wildcard source:AEPEventSource.wildcard listener:^(AEPEvent * _Nonnull event) { @@ -139,7 +138,7 @@ + (BOOL)configureEventExclusionList:(nullable NSArray *)eventNames e // If already configured allowList if ([AdobeBranchExtensionConfig instance].allowList.count != 0) { *configError = [NSError errorWithDomain:AdobeBranchExtensionErrorDomain code:ABEBranchConflictConfiguration userInfo:@{NSLocalizedFailureReasonErrorKey: @"Already configured allowList for AdobeBranchExtensionConfig"}]; - BNCLogError([NSString stringWithFormat:@"AdobeBranchExtensionConfig error: %@.", *configError]); + [[BranchLogger shared] logWarning:[NSString stringWithFormat:@"AdobeBranchExtensionConfig error: %@.", *configError]]; return NO; } else { [AdobeBranchExtensionConfig instance].exclusionList = eventNames; @@ -153,7 +152,7 @@ + (BOOL)configureEventAllowList:(nullable NSArray *)eventNames error // If already configured allowList if ([AdobeBranchExtensionConfig instance].exclusionList.count != 0) { *configError = [NSError errorWithDomain:AdobeBranchExtensionErrorDomain code:ABEBranchConflictConfiguration userInfo:@{NSLocalizedFailureReasonErrorKey: @"Already configured exclusionList for AdobeBranchExtensionConfig"}]; - BNCLogError([NSString stringWithFormat:@"AdobeBranchExtensionConfig error: %@.", *configError]); + [[BranchLogger shared] logWarning:[NSString stringWithFormat:@"AdobeBranchExtensionConfig error: %@.", *configError]]; return NO; } else { [AdobeBranchExtensionConfig instance].allowList = eventNames; @@ -165,7 +164,7 @@ + (BOOL)configureEventAllowList:(nullable NSArray *)eventNames error #pragma mark - Action Events - (void)handleEvent:(AEPEvent*)event { - BNCLogDebug([NSString stringWithFormat:@"Handling Event: %@", event]); + [[BranchLogger shared] logDebug:[NSString stringWithFormat:@"Handling Event: %@", event]]; if ([[AdobeBranchExtensionConfig instance].eventTypes containsObject:event.type] && [[AdobeBranchExtensionConfig instance].eventSources containsObject:event.source]) { @@ -334,11 +333,11 @@ - (void) passAdobeIdsToBranch:(AEPEvent*)eventToProcess { AEPSharedStateResult *configSharedState = [self.runtime getSharedStateWithExtensionName:eventToProcess.data[ABEAdobeEventDataKey_StateOwner] event:eventToProcess barrier:NO]; if (!configSharedState.value) { - BNCLogDebug(@"BranchSDK_ Could not process event, configuration shared state is pending"); + [[BranchLogger shared] logWarning: @"BranchSDK_ Could not process event, configuration shared state is pending"]; return; } if (error) { - BNCLogDebug(@"BranchSDK_ Could not process event, an error occured while retrieving configuration shared state"); + [[BranchLogger shared] logWarning: @"BranchSDK_ Could not process event, an error occured while retrieving configuration shared state"]; return; }