summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Guerra <fabian.guerra@mapbox.com>2018-11-01 14:35:38 -0700
committerFabian Guerra <fabian.guerra@mapbox.com>2018-11-13 15:56:40 -0800
commit909c81fdde06aed7467463ac2055c642f79e69ae (patch)
tree10c6bcf4abe5868e7f25ab123a8c8a58a151cb9a
parent7f35b5dd1721ab645891834c6910d3e3281bdfb3 (diff)
downloadqtlocation-mapboxgl-909c81fdde06aed7467463ac2055c642f79e69ae.tar.gz
[ios, macos] Log network requests.
-rw-r--r--platform/darwin/src/http_file_source.mm5
1 files changed, 5 insertions, 0 deletions
diff --git a/platform/darwin/src/http_file_source.mm b/platform/darwin/src/http_file_source.mm
index 4a16ad82fb..9726f6064f 100644
--- a/platform/darwin/src/http_file_source.mm
+++ b/platform/darwin/src/http_file_source.mm
@@ -7,6 +7,7 @@
#include <mbgl/util/version.hpp>
#import <Foundation/Foundation.h>
+#import "MGLLoggingConfiguration_Private.h"
#include <mutex>
#include <chrono>
@@ -202,6 +203,7 @@ std::unique_ptr<AsyncRequest> HTTPFileSource::request(const Resource& resource,
@autoreleasepool {
NSURL* url = [NSURL URLWithString:@(resource.url.c_str())];
+ MGLLogDebug(@"Requesting URI: %@", url.relativePath);
if (impl->accountType == 0 &&
([url.host isEqualToString:@"mapbox.com"] || [url.host hasSuffix:@".mapbox.com"])) {
NSString* absoluteString = [url.absoluteString
@@ -231,6 +233,8 @@ std::unique_ptr<AsyncRequest> HTTPFileSource::request(const Resource& resource,
using Error = Response::Error;
if (error) {
+ MGLLogError(@"Requesting: %@ failed with error: %@", res.URL.relativePath, error);
+
if (data) {
response.data =
std::make_shared<std::string>((const char*)[data bytes], [data length]);
@@ -262,6 +266,7 @@ std::unique_ptr<AsyncRequest> HTTPFileSource::request(const Resource& resource,
}
} else if ([res isKindOfClass:[NSHTTPURLResponse class]]) {
const long responseCode = [(NSHTTPURLResponse *)res statusCode];
+ MGLLogDebug(@"Requesting %@ returned responseCode: %lu", res.URL.relativePath, responseCode);
NSDictionary *headers = [(NSHTTPURLResponse *)res allHeaderFields];
NSString *cache_control = [headers objectForKey:@"Cache-Control"];