summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLMapSnapshotter.mm
diff options
context:
space:
mode:
authorFabian Guerra Soto <fabian.guerra@mapbox.com>2018-11-14 15:42:18 -0800
committerGitHub <noreply@github.com>2018-11-14 15:42:18 -0800
commitc8fbcfd322e1af4520f0bdc7e5945f6ffd3b4b73 (patch)
tree9158facaa7fc8b728a69f87f494a71fb659d9727 /platform/darwin/src/MGLMapSnapshotter.mm
parent86677b97c6d5e7db75358e9f5745dab4cec5d0e4 (diff)
downloadqtlocation-mapboxgl-c8fbcfd322e1af4520f0bdc7e5945f6ffd3b4b73.tar.gz
[ios, macos] Logging. (#13235)
* [ios, macos] Update the logging subsystem to platform agnostic. * [ios, macos] Add coordinate to string function. * [ios, macos] Add BOOL to string function. * [ios, macos] Add tracing logs. * [ios, macos] Add tracing logs to generated style classes. * [ios, macos] Split logging categories accordingly to MGLLoggingLevel. * [ios, macos] Log network requests. * [ios, macos] Migrate NSAssert to MGLAssert. * [ios, macos] Include MGLLoggingConfiguration to filesource-files.txt. * [ios, macos] Fix logger string specifier for the line parameter. * [ios, macos] Add logs to shapes classes. * [ios, macos] Add logs to offline classes. * [ios, macos] Add logs to annotation classes. * [ios, macos] Add logs to foundation classes. * [ios, macos] Fix snapshotter size logging. * [macos] Add logs to map view. * [ios, macos] Fix string from boolean prefix, add custom function for NSCAssert. * Log size test * [ios, macos] Add logging conditional compilation flag. * [ios, macos] Rename function NSStringFromMGLTransition to MGLStringFromMGLTransition. * [ios, macos] Remove verbose logging for release builds. * [ios, macos] Rename NSStringFromCLLocationCoordinate2D to MGLStringFromCLLocationCoordinate2D. * [ios, macos] Clean unnecesary blank lines in MGLLight.mm set methods. * [ios, macos] Fix logging grammar, format, function names. * [ios, macos] Remove compilation flag, rename flags.
Diffstat (limited to 'platform/darwin/src/MGLMapSnapshotter.mm')
-rw-r--r--platform/darwin/src/MGLMapSnapshotter.mm15
1 files changed, 13 insertions, 2 deletions
diff --git a/platform/darwin/src/MGLMapSnapshotter.mm b/platform/darwin/src/MGLMapSnapshotter.mm
index 590c387145..3c5e36f8f2 100644
--- a/platform/darwin/src/MGLMapSnapshotter.mm
+++ b/platform/darwin/src/MGLMapSnapshotter.mm
@@ -15,6 +15,7 @@
#import "NSBundle+MGLAdditions.h"
#import "MGLStyle.h"
#import "MGLAttributionInfo_Private.h"
+#import "MGLLoggingConfiguration_Private.h"
#if TARGET_OS_IPHONE
#import "UIImage+MGLAdditions.h"
@@ -31,6 +32,12 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64;
- (instancetype _Nonnull)initWithStyleURL:(nullable NSURL *)styleURL camera:(MGLMapCamera *)camera size:(CGSize) size
{
+#if TARGET_OS_IPHONE
+ NSString *sizeString = NSStringFromCGSize(size);
+#else
+ NSString *sizeString = NSStringFromSize(size);
+#endif
+ MGLLogDebug(@"Initializing withStyleURL: %@ camera: %@ size: %@", styleURL, camera, sizeString);
self = [super init];
if (self) {
if ( !styleURL)
@@ -123,7 +130,7 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64;
- (void)dealloc {
if (_completion) {
- NSAssert(_snapshotCallback, @"Snapshot in progress - there should be a valid callback");
+ MGLAssert(_snapshotCallback, @"Snapshot in progress - there should be a valid callback");
[MGLMapSnapshotter completeWithErrorCode:MGLErrorCodeSnapshotFailed
description:@"MGLMapSnapshotter deallocated prior to snapshot completion."
@@ -134,6 +141,7 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64;
- (instancetype)initWithOptions:(MGLMapSnapshotOptions *)options
{
+ MGLLogDebug(@"Initializing withOptions: %@", options);
self = [super init];
if (self) {
[self setOptions:options];
@@ -143,6 +151,7 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64;
- (void)startWithCompletionHandler:(MGLMapSnapshotCompletionHandler)completion
{
+ MGLLogDebug(@"Starting withCompletionHandler: %@", completion);
[self startWithQueue:dispatch_get_main_queue() completionHandler:completion];
}
@@ -173,7 +182,7 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64;
__typeof__(self) strongSelf = weakSelf;
// If self had died, _snapshotCallback would have been destroyed and this block would not be executed
- NSCAssert(strongSelf, @"Snapshot callback executed after being destroyed.");
+ MGLCAssert(strongSelf, @"Snapshot callback executed after being destroyed.");
if (!strongSelf.completion)
return;
@@ -500,6 +509,7 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64;
- (void)cancel
{
+ MGLLogInfo(@"Cancelling snapshotter.");
self.cancelled = YES;
if (_snapshotCallback) {
@@ -529,6 +539,7 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64;
- (void)setOptions:(MGLMapSnapshotOptions *)options
{
+ MGLLogDebug(@"Setting options: %@", options);
_options = options;
mbgl::DefaultFileSource *mbglFileSource = [MGLOfflineStorage sharedOfflineStorage].mbglFileSource;
_mbglThreadPool = mbgl::sharedThreadPool();