Skip to content

Commit

Permalink
Updated logging (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
nsingh-branch authored Mar 8, 2024
1 parent 7913578 commit dac62da
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions AdobeBranchExtension/Classes/AdobeBranchExtensionClass.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#import "AdobeBranchExtension.h"
#import "AdobeBranchExtensionConfig.h"
#import <BranchSDK/Branch.h>
#import <BranchSDK/BNCLog.h>
#import <BranchSDK/BranchLogger.h>
#import <BranchSDK/BranchPluginSupport.h>
#import <BranchSDK/BranchEvent.h>

Expand Down Expand Up @@ -70,9 +70,8 @@ - (nullable instancetype)initWithRuntime:(id<AEPExtensionRuntime> _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) {
Expand Down Expand Up @@ -139,7 +138,7 @@ + (BOOL)configureEventExclusionList:(nullable NSArray<NSString *> *)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;
Expand All @@ -153,7 +152,7 @@ + (BOOL)configureEventAllowList:(nullable NSArray<NSString *> *)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;
Expand All @@ -165,7 +164,7 @@ + (BOOL)configureEventAllowList:(nullable NSArray<NSString *> *)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]) {
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit dac62da

Please sign in to comment.