Log multi-line MountItems properly; log every MountItem in a BatchMountItem

Summary:
Log every item in a BatchMountItem. There's a lot of useful debug information being hidden there currently.

Changelog:
[Internal]

Reviewed By: mdvacca

Differential Revision: D17254629

fbshipit-source-id: c72f0aa8506059da5225ebead24d3f8ead5bdebd
This commit is contained in:
Joshua Gross
2019-09-09 19:54:33 -07:00
committed by Facebook Github Bot
parent e92235ddf2
commit 21977f895a
2 changed files with 19 additions and 9 deletions
@@ -470,7 +470,12 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
long batchedExecutionStartTime = SystemClock.uptimeMillis();
for (MountItem mountItem : mountItemsToDispatch) {
if (DEBUG) {
FLog.d(TAG, "dispatchMountItems: Executing mountItem: " + mountItem);
// If a MountItem description is split across multiple lines, it's because it's a compound
// MountItem. Log each line separately.
String[] mountItemLines = mountItem.toString().split("\n");
for (String m : mountItemLines) {
FLog.d(TAG, "dispatchMountItems: Executing mountItem: " + m);
}
}
mountItem.execute(mMountingManager);
}
@@ -6,10 +6,6 @@
*/
package com.facebook.react.fabric.mounting.mountitems;
import static com.facebook.react.fabric.FabricUIManager.DEBUG;
import static com.facebook.react.fabric.FabricUIManager.TAG;
import com.facebook.common.logging.FLog;
import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.react.bridge.ReactMarker;
import com.facebook.react.bridge.ReactMarkerConstants;
@@ -57,9 +53,6 @@ public class BatchMountItem implements MountItem {
for (int mountItemIndex = 0; mountItemIndex < mSize; mountItemIndex++) {
MountItem mountItem = mMountItems[mountItemIndex];
if (DEBUG) {
FLog.d(TAG, "Executing mountItem: " + mountItem);
}
mountItem.execute(mountingManager);
}
@@ -73,6 +66,18 @@ public class BatchMountItem implements MountItem {
@Override
public String toString() {
return "BatchMountItem - size " + mMountItems.length;
StringBuilder s = new StringBuilder();
for (int i = 0; i < mSize; i++) {
if (s.length() > 0) {
s.append("\n");
}
s.append("BatchMountItem (")
.append(i + 1)
.append("/")
.append(mSize)
.append("): ")
.append(mMountItems[i]);
}
return s.toString();
}
}