diff --git a/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java b/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java index 16228a6..ce05ad6 100644 --- a/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java +++ b/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java @@ -50,7 +50,6 @@ public class CodePush { private final String PENDING_UPDATE_IS_LOADING_KEY = "isLoading"; private final String ASSETS_BUNDLE_PREFIX = "assets://"; private final String CODE_PUSH_PREFERENCES = "CodePush"; - private final String CODE_PUSH_TAG = "CodePush"; private final String DOWNLOAD_PROGRESS_EVENT_NAME = "CodePushDownloadProgress"; private final String RESOURCES_BUNDLE = "resources.arsc"; private final String REACT_DEV_BUNDLE_CACHE_FILE_NAME = "ReactNativeDevBundle.js"; @@ -136,9 +135,9 @@ public class CodePush { return packageFilePath; } else { // The binary version is newer. - Log.d(CODE_PUSH_TAG, "Found a package installed via CodePush that was " + - "installed under a different binary version, so the JS bundle packaged " + - "in the binary will be used as the most current package."); + CodePushUtils.log("Found a package installed via CodePush that was installed " + + "under a different binary version, so the JS bundle packaged in the " + + "binary will be used as the most current package."); return binaryJsBundleUrl; } } catch (IOException e) { @@ -237,8 +236,8 @@ public class CodePush { return pendingUpdate; } catch (JSONException e) { // Should not happen. - Log.e(CODE_PUSH_TAG, "Unable to parse pending update metadata " + - pendingUpdateString + " stored in SharedPreferences", e); + CodePushUtils.log("Unable to parse pending update metadata " + pendingUpdateString + + " stored in SharedPreferences"); return null; } } @@ -252,7 +251,7 @@ public class CodePush { if (updateIsLoading) { // Pending update was initialized, but notifyApplicationReady was not called. // Therefore, deduce that it is a broken update and rollback. - Log.d(CODE_PUSH_TAG, "Update did not finish loading the last time, rolling back to a previous version."); + CodePushUtils.log("Update did not finish loading the last time, rolling back to a previous version."); rollbackPackage(); } else { // Clear the React dev bundle cache so that new updates can be loaded. diff --git a/android/app/src/main/java/com/microsoft/codepush/react/CodePushUtils.java b/android/app/src/main/java/com/microsoft/codepush/react/CodePushUtils.java index 757b149..80203dc 100644 --- a/android/app/src/main/java/com/microsoft/codepush/react/CodePushUtils.java +++ b/android/app/src/main/java/com/microsoft/codepush/react/CodePushUtils.java @@ -1,5 +1,7 @@ package com.microsoft.codepush.react; +import android.util.Log; + import com.facebook.react.bridge.Arguments; import com.facebook.react.bridge.NoSuchKeyException; import com.facebook.react.bridge.ReadableArray; @@ -23,6 +25,8 @@ import java.util.Iterator; public class CodePushUtils { + public static final String REACT_NATIVE_LOG_TAG = "ReactNative"; + public static String appendPathComponent(String basePath, String appendPathComponent) { return new File(basePath, appendPathComponent).getAbsolutePath(); } @@ -260,4 +264,8 @@ public class CodePushUtils { return null; } } + + public static void log(String message) { + Log.d(REACT_NATIVE_LOG_TAG, "[CodePush] " + message); + } }