diff options
author | Fabian Guerra <fabian.guerra@mapbox.com> | 2018-11-14 12:06:16 -0800 |
---|---|---|
committer | Fabian Guerra <fabian.guerra@mapbox.com> | 2018-11-14 12:06:16 -0800 |
commit | 772344357c5bf68a02448289395904cdd15cbc4e (patch) | |
tree | 73b3ab318d33a4b3d94db10fb2023b67a0899ec9 | |
parent | 7b9ec02b562af24412acf05ea32454e703580a92 (diff) | |
download | qtlocation-mapboxgl-772344357c5bf68a02448289395904cdd15cbc4e.tar.gz |
[ios, macos] Fix logging grammar, format, function names.
-rw-r--r-- | platform/darwin/src/MGLLoggingConfiguration.m | 8 | ||||
-rw-r--r-- | platform/darwin/src/MGLOfflinePack.mm | 3 | ||||
-rw-r--r-- | platform/darwin/src/MGLOfflineStorage.mm | 2 | ||||
-rw-r--r-- | platform/ios/src/MGLMapView.mm | 8 | ||||
-rw-r--r-- | platform/macos/src/MGLMapView.mm | 4 |
5 files changed, 12 insertions, 13 deletions
diff --git a/platform/darwin/src/MGLLoggingConfiguration.m b/platform/darwin/src/MGLLoggingConfiguration.m index f0943d3a4a..fc2d231d4a 100644 --- a/platform/darwin/src/MGLLoggingConfiguration.m +++ b/platform/darwin/src/MGLLoggingConfiguration.m @@ -44,17 +44,23 @@ if (@available(iOS 10.0, macOS 10.12.0, *)) { static dispatch_once_t once; static os_log_t info_log; +#if MGL_ENABLE_DEBUG_LOGGING static os_log_t debug_log; +#endif static os_log_t error_log; static os_log_t fault_log; static os_log_type_t log_types[] = { OS_LOG_TYPE_DEFAULT, OS_LOG_TYPE_INFO, +#if MGL_ENABLE_DEBUG_LOGGING OS_LOG_TYPE_DEBUG, +#endif OS_LOG_TYPE_ERROR, OS_LOG_TYPE_FAULT }; dispatch_once(&once, ^ { info_log = os_log_create("com.mapbox.maps", "INFO"); +#if MGL_ENABLE_DEBUG_LOGGING debug_log = os_log_create("com.mapbox.maps", "DEBUG"); +#endif error_log = os_log_create("com.mapbox.maps", "ERROR"); fault_log = os_log_create("com.mapbox.maps", "FAULT"); }); @@ -80,8 +86,6 @@ break; } - NSUInteger logTypesCount = sizeof(log_types) / sizeof(os_log_type_t); - NSAssert(level <= logTypesCount, @"There is an attempt to log a non suported logging level."); os_log_type_t logType = log_types[level]; os_log_with_type(mapbox_log, logType, "%@ - %lu: %@", fileName, (unsigned long)line, message); } else { diff --git a/platform/darwin/src/MGLOfflinePack.mm b/platform/darwin/src/MGLOfflinePack.mm index 697dadd412..aa317d33e8 100644 --- a/platform/darwin/src/MGLOfflinePack.mm +++ b/platform/darwin/src/MGLOfflinePack.mm @@ -214,8 +214,9 @@ private: } - (void)didReceiveError:(NSError *)error { - MGLLogInfo(@"Notifying pack error."); MGLLogError(@"Error: %@", error.localizedDescription); + MGLLogInfo(@"About notifying pack error."); + NSDictionary *userInfo = @{ MGLOfflinePackUserInfoKeyError: error }; NSNotificationCenter *noteCenter = [NSNotificationCenter defaultCenter]; [noteCenter postNotificationName:MGLOfflinePackErrorNotification diff --git a/platform/darwin/src/MGLOfflineStorage.mm b/platform/darwin/src/MGLOfflineStorage.mm index 42002152ed..24aaeb546c 100644 --- a/platform/darwin/src/MGLOfflineStorage.mm +++ b/platform/darwin/src/MGLOfflineStorage.mm @@ -480,7 +480,7 @@ const MGLExceptionName MGLUnsupportedRegionTypeException = @"MGLUnsupportedRegio } - (void)setMaximumAllowedMapboxTiles:(uint64_t)maximumCount { - MGLLogDebug(@"Setting mazimumAllowedMapboxTiles: %lu", (unsigned long)maximumCount); + MGLLogDebug(@"Setting maximumAllowedMapboxTiles: %lu", (unsigned long)maximumCount); _mbglFileSource->setOfflineMapboxTileCountLimit(maximumCount); } diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index a20936fda8..18b333d9ab 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -3240,13 +3240,7 @@ public: - (void)setVisibleCoordinates:(const CLLocationCoordinate2D *)coordinates count:(NSUInteger)count edgePadding:(UIEdgeInsets)insets direction:(CLLocationDirection)direction duration:(NSTimeInterval)duration animationTimingFunction:(nullable CAMediaTimingFunction *)function completionHandler:(nullable void (^)(void))completion { - MGLLogDebug(@"Setting: %lu coordinates edgePadding: %@ direction: %f duration: %f animationTimingFunction: %@ completionHandler: %@", - count, - NSStringFromUIEdgeInsets(insets), - direction, - duration, - function, - completion); + MGLLogDebug(@"Setting: %lu coordinates edgePadding: %@ direction: %f duration: %f animationTimingFunction: %@ completionHandler: %@", count, NSStringFromUIEdgeInsets(insets), direction, duration, function, completion); self.userTrackingMode = MGLUserTrackingModeNone; self.cameraChangeReasonBitmask |= MGLCameraChangeReasonProgrammatic; diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index c9e601a88d..486870f51c 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -986,12 +986,12 @@ public: } - (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate { - MGLLogDebug(@"Setting centerCoordinate: %@", NSStringFromCLLocationCoordinate2D(centerCoordinate)); + MGLLogDebug(@"Setting centerCoordinate: %@", MGLStringFromCLLocationCoordinate2D(centerCoordinate)); [self setCenterCoordinate:centerCoordinate animated:NO]; } - (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate animated:(BOOL)animated { - MGLLogDebug(@"Setting centerCoordinate: %@ animated: %@", NSStringFromCLLocationCoordinate2D(centerCoordinate), MGLStringFromBOOL(animated)); + MGLLogDebug(@"Setting centerCoordinate: %@ animated: %@", MGLStringFromCLLocationCoordinate2D(centerCoordinate), MGLStringFromBOOL(animated)); [self willChangeValueForKey:@"centerCoordinate"]; _mbglMap->setLatLng(MGLLatLngFromLocationCoordinate2D(centerCoordinate), MGLEdgeInsetsFromNSEdgeInsets(self.contentInsets), |