diff --git a/MapboxMobileEvents/MMEConstants.h b/MapboxMobileEvents/MMEConstants.h index 7396a50d..60aba5a7 100644 --- a/MapboxMobileEvents/MMEConstants.h +++ b/MapboxMobileEvents/MMEConstants.h @@ -11,6 +11,15 @@ extern NSString * const MMEAPIClientHeaderFieldContentEncodingKey; extern NSString * const MMEAPIClientHTTPMethodPost; extern NSString * const MMEErrorDomain; +// Debug types +extern NSString * const MMEDebugEventTypeFlush; +extern NSString * const MMEDebugEventTypePush; +extern NSString * const MMEDebugEventTypePost; +extern NSString * const MMEDebugEventTypeTurnstile; +extern NSString * const MMEDebugEventTypeBackgroundTask; +extern NSString * const MMEDebugEventTypeMetricCollection; +extern NSString * const MMEDebugEventTypeLocationManager; + // Event types extern NSString * const MMEEventTypeAppUserTurnstile; extern NSString * const MMEEventTypeMapLoad; @@ -60,6 +69,7 @@ extern NSString * const MMEEventTypeNavigationArrive; extern NSString * const MMEEventTypeNavigationCancel; extern NSString * const MMEEventTypeNavigationFeedback; extern NSString * const MMEEventTypeNavigationReroute; +extern NSString * const MMEDebugEventType; // SDK event source extern NSString * const MMEEventSource; diff --git a/MapboxMobileEvents/MMEConstants.m b/MapboxMobileEvents/MMEConstants.m index d1a82e50..62cf675a 100644 --- a/MapboxMobileEvents/MMEConstants.m +++ b/MapboxMobileEvents/MMEConstants.m @@ -11,6 +11,14 @@ NSString * const MMEAPIClientHTTPMethodPost = @"POST"; NSString * const MMEErrorDomain = @"MMEErrorDomain"; +NSString * const MMEDebugEventTypeFlush = @"flush"; +NSString * const MMEDebugEventTypePush = @"push"; +NSString * const MMEDebugEventTypePost = @"post"; +NSString * const MMEDebugEventTypeTurnstile = @"turnstile"; +NSString * const MMEDebugEventTypeBackgroundTask = @"backgroundTask"; +NSString * const MMEDebugEventTypeMetricCollection = @"metricCollection"; +NSString * const MMEDebugEventTypeLocationManager = @"locationManager"; + NSString * const MMEEventTypeAppUserTurnstile = @"appUserTurnstile"; NSString * const MMEEventTypeMapLoad = @"map.load"; NSString * const MMEEventTypeMapTap = @"map.click"; @@ -59,6 +67,7 @@ NSString * const MMEEventTypeNavigationCancel = @"navigation.cancel"; NSString * const MMEEventTypeNavigationFeedback = @"navigation.feedback"; NSString * const MMEEventTypeNavigationReroute = @"navigation.reroute"; +NSString * const MMEDebugEventType = @"debug.type"; NSString * const MMEEventSource = @"mapbox"; diff --git a/MapboxMobileEvents/MMEEventLogger.h b/MapboxMobileEvents/MMEEventLogger.h index cdff7431..95557435 100644 --- a/MapboxMobileEvents/MMEEventLogger.h +++ b/MapboxMobileEvents/MMEEventLogger.h @@ -6,9 +6,11 @@ NS_ASSUME_NONNULL_BEGIN @interface MMEEventLogger : NSObject -+ (BOOL)isEnabled; -+ (void)setEnabled:(BOOL)enabled; -+ (void)logEvent:(MMEEvent *)event; +@property (nonatomic, getter=isEnabled) BOOL enabled; + ++ (instancetype)sharedLogger; + +- (void)logEvent:(MMEEvent *)event; @end diff --git a/MapboxMobileEvents/MMEEventLogger.m b/MapboxMobileEvents/MMEEventLogger.m index 3b0c8e99..e382aa5f 100644 --- a/MapboxMobileEvents/MMEEventLogger.m +++ b/MapboxMobileEvents/MMEEventLogger.m @@ -1,21 +1,72 @@ #import "MMEEventLogger.h" +@interface MMEEventLogger() + +@property (nonatomic, copy) NSString *dateForDebugLogFile; +@property (nonatomic) NSFileManager *fileManager; +@property (nonatomic) dispatch_queue_t debugLogSerialQueue; + +@end + @implementation MMEEventLogger -static BOOL _enabled; ++ (instancetype)sharedLogger { + static MMEEventLogger *_sharedLogger; + static dispatch_once_t onceToken; + + dispatch_once(&onceToken, ^{ + _sharedLogger = [[MMEEventLogger alloc] init]; + }); + + return _sharedLogger; +} -+ (void)logEvent:(MMEEvent *)event { - if (_enabled) { +- (void)logEvent:(MMEEvent *)event { + if (self.isEnabled) { NSLog(@"%@", [NSString stringWithFormat:@"Mapbox Telemetry event %@", event]); + + [self writeEventToLocalDebugLog:event]; } } -+ (BOOL)isEnabled { - return _enabled; +- (void)writeEventToLocalDebugLog:(MMEEvent *)event { + if (!self.isEnabled) { + return; + } + + if (!self.dateForDebugLogFile) { + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + [dateFormatter setDateFormat:@"yyyy'-'MM'-'dd"]; + [dateFormatter setTimeZone:[NSTimeZone systemTimeZone]]; + self.dateForDebugLogFile = [dateFormatter stringFromDate:[NSDate date]]; + } + + if (!self.debugLogSerialQueue) { + NSString *uniqueID = [[NSProcessInfo processInfo] globallyUniqueString]; + NSString *appBundleID = [[NSBundle mainBundle] bundleIdentifier]; + self.debugLogSerialQueue = dispatch_queue_create([[NSString stringWithFormat:@"%@.%@.events.debugLog", appBundleID, uniqueID] UTF8String], DISPATCH_QUEUE_SERIAL); + } + + dispatch_async(self.debugLogSerialQueue, ^{ + if ([NSJSONSerialization isValidJSONObject:event]) { + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:event options:NSJSONWritingPrettyPrinted error:nil]; + + NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; + jsonString = [jsonString stringByAppendingString:@",\n"]; + + NSString *logFilePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingPathComponent:[NSString stringWithFormat:@"telemetry_log-%@.json", self.dateForDebugLogFile]]; + + NSFileManager *fileManager = [[NSFileManager alloc] init]; + if ([fileManager fileExistsAtPath:logFilePath]) { + NSFileHandle *fileHandle = [NSFileHandle fileHandleForWritingAtPath:logFilePath]; + [fileHandle seekToEndOfFile]; + [fileHandle writeData:[jsonString dataUsingEncoding:NSUTF8StringEncoding]]; + } else { + [fileManager createFileAtPath:logFilePath contents:[jsonString dataUsingEncoding:NSUTF8StringEncoding] attributes:@{ NSFileProtectionKey: NSFileProtectionCompleteUntilFirstUserAuthentication }]; + } + } + }); } -+ (void)setEnabled:(BOOL)enabled { - _enabled = enabled; -} @end diff --git a/MapboxMobileEvents/MMEEventsManager.m b/MapboxMobileEvents/MMEEventsManager.m index 0e1682ff..37078480 100644 --- a/MapboxMobileEvents/MMEEventsManager.m +++ b/MapboxMobileEvents/MMEEventsManager.m @@ -122,12 +122,14 @@ - (void)pauseOrResumeMetricsCollectionIfRequired { !self.isMetricsEnabledForInUsePermissions) { if (_backgroundTaskIdentifier == UIBackgroundTaskInvalid) { _backgroundTaskIdentifier = [self.application beginBackgroundTaskWithExpirationHandler:^{ - [self pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription: @"Ending background task", + [self pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypeBackgroundTask, + MMEEventKeyLocalDebugDescription: @"Ending background task", @"Identifier": @(_backgroundTaskIdentifier)}]; [self.application endBackgroundTask:_backgroundTaskIdentifier]; _backgroundTaskIdentifier = UIBackgroundTaskInvalid; }]; - [self pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription: @"Initiated background task", + [self pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypeBackgroundTask, + MMEEventKeyLocalDebugDescription: @"Initiated background task", @"Identifier": @(_backgroundTaskIdentifier)}]; [self flush]; } @@ -162,16 +164,19 @@ - (void)flush { [self.apiClient postEvents:events completionHandler:^(NSError * _Nullable error) { __strong __typeof__(weakSelf) strongSelf = weakSelf; if (error) { - [strongSelf pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription: @"Network error", + [strongSelf pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypePost, + MMEEventKeyLocalDebugDescription: @"Network error", @"error": error}]; } else { - [strongSelf pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription: @"post", + [strongSelf pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypePost, + MMEEventKeyLocalDebugDescription: @"post", @"debug.eventsCount": @(events.count)}]; } if (_backgroundTaskIdentifier != UIBackgroundTaskInvalid) { - [self pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription: @"Ending background task", + [self pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypeBackgroundTask, + MMEEventKeyLocalDebugDescription: @"Ending background task", @"Identifier": @(_backgroundTaskIdentifier)}]; [self.application endBackgroundTask:_backgroundTaskIdentifier]; _backgroundTaskIdentifier = UIBackgroundTaskInvalid; @@ -181,42 +186,50 @@ - (void)flush { [self.eventQueue removeAllObjects]; [self.timerManager cancel]; - [self pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription:@"flush"}]; + [self pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypeFlush, + MMEEventKeyLocalDebugDescription:@"flush"}]; } - (void)sendTurnstileEvent { if (self.nextTurnstileSendDate && [[self.dateWrapper date] timeIntervalSinceDate:self.nextTurnstileSendDate] < 0) { - [self pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription: @"Turnstile event already sent; waiting until %@ to send another one"}]; + [self pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypeTurnstile, + MMEEventKeyLocalDebugDescription: @"Turnstile event already sent; waiting until %@ to send another one"}]; return; } if (!self.apiClient.accessToken) { - [self pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription: @"No access token sent, cannot can't send turntile event"}]; + [self pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypeTurnstile, + MMEEventKeyLocalDebugDescription: @"No access token sent, cannot can't send turntile event"}]; return; } if (!self.apiClient.userAgentBase) { - [self pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription: @"No user agent base set, cannot can't send turntile event"}]; + [self pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypeTurnstile, + MMEEventKeyLocalDebugDescription: @"No user agent base set, cannot can't send turntile event"}]; return; } if (!self.apiClient.hostSDKVersion) { - [self pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription: @"No host SDK version set, cannot can't send turntile event"}]; + [self pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypeTurnstile, + MMEEventKeyLocalDebugDescription: @"No host SDK version set, cannot can't send turntile event"}]; return; } if (!self.commonEventData.vendorId) { - [self pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription: @"No vendor id available, cannot can't send turntile event"}]; + [self pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypeTurnstile, + MMEEventKeyLocalDebugDescription: @"No vendor id available, cannot can't send turntile event"}]; return; } if (!self.commonEventData.model) { - [self pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription: @"No model available, cannot can't send turntile event"}]; + [self pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypeTurnstile, + MMEEventKeyLocalDebugDescription: @"No model available, cannot can't send turntile event"}]; return; } if (!self.commonEventData.iOSVersion) { - [self pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription: @"No iOS version available, cannot can't send turntile event"}]; + [self pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypeTurnstile, + MMEEventKeyLocalDebugDescription: @"No iOS version available, cannot can't send turntile event"}]; return; } @@ -232,18 +245,22 @@ - (void)sendTurnstileEvent { MMEEventKeyEnabledTelemetry: @([self isEnabled])}; MMEEvent *turnstileEvent = [MMEEvent turnstileEventWithAttributes:turnstileEventAttributes]; - [self pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription: [NSString stringWithFormat:@"Sending turnstile event: %@", turnstileEvent]}]; + [self pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypeTurnstile, + MMEEventKeyLocalDebugDescription: [NSString stringWithFormat:@"Sending turnstile event: %@", turnstileEvent]}]; + [MMEEventLogger.sharedLogger logEvent:turnstileEvent]; __weak __typeof__(self) weakSelf = self; [self.apiClient postEvent:turnstileEvent completionHandler:^(NSError * _Nullable error) { __strong __typeof__(weakSelf) strongSelf = weakSelf; if (error) { - [self pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription: [NSString stringWithFormat:@"Could not send turnstile event: %@", error]}]; + [self pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypeTurnstile, + MMEEventKeyLocalDebugDescription: [NSString stringWithFormat:@"Could not send turnstile event: %@", error]}]; return; } [strongSelf updateNextTurnstileSendDate]; - [self pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription: @"Sent turnstile event"}]; + [self pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypeTurnstile, + MMEEventKeyLocalDebugDescription: @"Sent turnstile event"}]; }]; } @@ -273,19 +290,21 @@ - (void)createAndPushEventBasedOnName:(NSString *)name attributes:(NSDictionary } if (event) { - [self pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription: [NSString stringWithFormat:@"Pushing event: %@", event]}]; + [self pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypePush, + MMEEventKeyLocalDebugDescription: [NSString stringWithFormat:@"Pushing event: %@", event]}]; [self pushEvent:event]; } else { - [self pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription: [NSString stringWithFormat:@"Unknown event: %@", event]}]; + [self pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypePush, + MMEEventKeyLocalDebugDescription: [NSString stringWithFormat:@"Unknown event: %@", event]}]; } } - (void)setDebugLoggingEnabled:(BOOL)debugLoggingEnabled { - [[MMEEventLogger class] setEnabled:debugLoggingEnabled]; + MMEEventLogger.sharedLogger.enabled = debugLoggingEnabled; } - (BOOL)isDebugLoggingEnabled { - return [[MMEEventLogger class] isEnabled]; + return [MMEEventLogger.sharedLogger isEnabled]; } #pragma mark - Internal API @@ -302,9 +321,11 @@ - (BOOL)isEnabled { } - (void)pauseMetricsCollection { - [self pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription: @"Pausing metrics collection..."}]; + [self pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypeMetricCollection, + MMEEventKeyLocalDebugDescription: @"Pausing metrics collection..."}]; if (self.isPaused) { - [self pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription: @"Already paused"}]; + [self pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypeMetricCollection, + MMEEventKeyLocalDebugDescription: @"Already paused"}]; return; } @@ -313,13 +334,16 @@ - (void)pauseMetricsCollection { [self.eventQueue removeAllObjects]; [self.locationManager stopUpdatingLocation]; - [self pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription: @"Paused and location manager stopped"}]; + [self pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypeLocationManager, + MMEEventKeyLocalDebugDescription: @"Paused and location manager stopped"}]; } - (void)resumeMetricsCollection { - [self pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription: @"Resuming metrics collection..."}]; + [self pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypeMetricCollection, + MMEEventKeyLocalDebugDescription: @"Resuming metrics collection..."}]; if (!self.isPaused || ![self isEnabled]) { - [self pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription: @"Already running"}]; + [self pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypeMetricCollection, + MMEEventKeyLocalDebugDescription: @"Already running"}]; return; } @@ -328,7 +352,8 @@ - (void)resumeMetricsCollection { if (self.locationMetricsEnabled) { [self.locationManager startUpdatingLocation]; } - [self pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription: @"Resumed and location manager started"}]; + [self pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypeLocationManager, + MMEEventKeyLocalDebugDescription: @"Resumed and location manager started"}]; } - (void)updateNextTurnstileSendDate { @@ -345,7 +370,8 @@ - (void)updateNextTurnstileSendDate { [calendar rangeOfUnit:NSCalendarUnitDay startDate:&startOfTomorrow interval:nil forDate:sometimeTomorrow]; self.nextTurnstileSendDate = startOfTomorrow; - [self pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription: [NSString stringWithFormat:@"Set next turnstile date to: %@", self.nextTurnstileSendDate]}]; + [self pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypeTurnstile, + MMEEventKeyLocalDebugDescription: [NSString stringWithFormat:@"Set next turnstile date to: %@", self.nextTurnstileSendDate]}]; } - (void)pushEvent:(MMEEvent *)event { @@ -354,12 +380,14 @@ - (void)pushEvent:(MMEEvent *)event { } if (self.paused) { - [self pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription: @"Aborting pushing event because collection is paused."}]; + [self pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypePush, + MMEEventKeyLocalDebugDescription: @"Aborting pushing event because collection is paused."}]; return; } [self.eventQueue addObject:event]; - [self pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription: [NSString stringWithFormat:@"Added event to event queue; event queue now has %ld events", (long)self.eventQueue.count]}]; + [self pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypePush, + MMEEventKeyLocalDebugDescription: [NSString stringWithFormat:@"Added event to event queue; event queue now has %ld events", (long)self.eventQueue.count]}]; if (self.eventQueue.count >= self.configuration.eventFlushCountThreshold) { [self flush]; @@ -375,13 +403,14 @@ - (void)pushDebugEventWithAttributes:(MMEMapboxEventAttributes *)attributes { [combinedAttributes setObject:[self.dateWrapper formattedDateStringForDate:[self.dateWrapper date]] forKey:@"created"]; [combinedAttributes setObject:self.uniqueIdentifer.rollingInstanceIdentifer forKey:@"instance"]; MMEEvent *debugEvent = [MMEEvent debugEventWithAttributes:combinedAttributes]; - [MMEEventLogger logEvent:debugEvent]; + [MMEEventLogger.sharedLogger logEvent:debugEvent]; } #pragma mark - MMELocationManagerDelegate - (void)locationManager:(MMELocationManager *)locationManager didUpdateLocations:(NSArray *)locations { - [self pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription: [NSString stringWithFormat:@"Location manager sent %ld locations", (long)locations.count]}]; + [self pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypeLocationManager, + MMEEventKeyLocalDebugDescription: [NSString stringWithFormat:@"Location manager sent %ld locations", (long)locations.count]}]; for (CLLocation *location in locations) { MMEMapboxEventAttributes *eventAttributes = @{MMEEventKeyCreated: [self.dateWrapper formattedDateStringForDate:[location timestamp]], @@ -396,19 +425,23 @@ - (void)locationManager:(MMELocationManager *)locationManager didUpdateLocations } - (void)locationManagerDidStartLocationUpdates:(MMELocationManager *)locationManager { - [self pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription: @"Location manager started location updates"}]; + [self pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypeLocationManager, + MMEEventKeyLocalDebugDescription: @"Location manager started location updates"}]; } - (void)locationManagerBackgroundLocationUpdatesDidTimeout:(MMELocationManager *)locationManager { - [self pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription: @"Location manager timed out"}]; + [self pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypeLocationManager, + MMEEventKeyLocalDebugDescription: @"Location manager timed out"}]; } - (void)locationManagerBackgroundLocationUpdatesDidAutomaticallyPause:(MMELocationManager *)locationManager { - [self pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription: @"Location manager automatically paused"}]; + [self pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypeLocationManager, + MMEEventKeyLocalDebugDescription: @"Location manager automatically paused"}]; } - (void)locationManagerDidStopLocationUpdates:(MMELocationManager *)locationManager { - [self pushDebugEventWithAttributes:@{MMEEventKeyLocalDebugDescription: @"Location manager stopped location updates"}]; + [self pushDebugEventWithAttributes:@{MMEDebugEventType: MMEDebugEventTypeLocationManager, + MMEEventKeyLocalDebugDescription: @"Location manager stopped location updates"}]; } @end diff --git a/MapboxMobileEvents/MMETrustKitWrapper.m b/MapboxMobileEvents/MMETrustKitWrapper.m index b4b8c0ae..b89e59ef 100644 --- a/MapboxMobileEvents/MMETrustKitWrapper.m +++ b/MapboxMobileEvents/MMETrustKitWrapper.m @@ -19,7 +19,7 @@ + (void)configureCertificatePinningValidation { return; } - if (![MMEEventLogger isEnabled]) { + if (![MMEEventLogger.sharedLogger isEnabled]) { void (^loggerBlock)(NSString *) = ^void(NSString *message){}; [TrustKit setLoggerBlock:loggerBlock]; }