summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http
diff options
context:
space:
mode:
authorAntonio Zugaldia <antonio@mapbox.com>2015-12-24 11:09:07 -0500
committerAntonio Zugaldia <antonio@mapbox.com>2015-12-24 11:25:17 -0500
commitd2b2336a9efc00978950cd3ee9d4d0af6ad7f1bf (patch)
tree21ed77c1f514ad332fb435f57cb6dcf65708c99f /platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http
parent845699e69899cec95254ce5ab244e88210b23298 (diff)
downloadqtlocation-mapboxgl-d2b2336a9efc00978950cd3ee9d4d0af6ad7f1bf.tar.gz
[android] better http log messages
Fixes #3411
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPContext.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPContext.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPContext.java
index 886c7b9af8..ee486cb65c 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPContext.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPContext.java
@@ -1,5 +1,6 @@
package com.mapbox.mapboxsdk.http;
+import android.text.TextUtils;
import android.util.Log;
import com.mapbox.mapboxsdk.constants.MapboxConstants;
@@ -80,7 +81,7 @@ class HTTPContext {
@Override
public void onFailure(Request request, IOException e) {
- Log.d(LOG_TAG, "onFailure: " + e.getMessage());
+ Log.w(LOG_TAG, String.format("[HTTP] Request could not be executed: %s", e.getMessage()));
int type = PERMANENT_ERROR;
if ((e instanceof UnknownHostException) || (e instanceof SocketException) || (e instanceof ProtocolException) || (e instanceof SSLException)) {
@@ -96,7 +97,15 @@ class HTTPContext {
@Override
public void onResponse(Response response) throws IOException {
- Log.d(LOG_TAG, "onResponse");
+ if (response.isSuccessful()) {
+ Log.d(LOG_TAG, String.format("[HTTP] Request was successful (code = %d).", response.code()));
+ } else {
+ // We don't want to call this unsuccessful because a 304 isn't really an error
+ String message = !TextUtils.isEmpty(response.message()) ? response.message() : "No additional information";
+ Log.d(LOG_TAG, String.format(
+ "[HTTP] Request with response code = %d: %s",
+ response.code(), message));
+ }
byte[] body;
try {