Format StubViewTree logs to be closer to other logs

Summary:
Debug logs should wrap React Tags in square brackets.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D27001202

fbshipit-source-id: 32fca9d0e1467a515ca3d9d1a3e24a35c23120db
This commit is contained in:
Joshua Gross
2021-03-12 09:33:24 -08:00
committed by Facebook GitHub Bot
parent fa64427236
commit b88ec8b144
@@ -49,15 +49,16 @@ void StubViewTree::mutate(ShadowViewMutationList const &mutations) {
auto stubView = std::make_shared<StubView>();
stubView->update(mutation.newChildShadowView);
auto tag = mutation.newChildShadowView.tag;
STUB_VIEW_LOG({ LOG(ERROR) << "StubView: Create: " << tag; });
STUB_VIEW_LOG({ LOG(ERROR) << "StubView: Create [" << tag << "]"; });
react_native_assert(registry.find(tag) == registry.end());
registry[tag] = stubView;
break;
}
case ShadowViewMutation::Delete: {
STUB_VIEW_LOG(
{ LOG(ERROR) << "Delete " << mutation.oldChildShadowView.tag; });
STUB_VIEW_LOG({
LOG(ERROR) << "Delete [" << mutation.oldChildShadowView.tag << "]";
});
react_native_assert(mutation.parentShadowView == ShadowView{});
react_native_assert(mutation.newChildShadowView == ShadowView{});
auto tag = mutation.oldChildShadowView.tag;
@@ -82,8 +83,8 @@ void StubViewTree::mutate(ShadowViewMutationList const &mutations) {
react_native_assert(childStubView->parentTag == NO_VIEW_TAG);
childStubView->update(mutation.newChildShadowView);
STUB_VIEW_LOG({
LOG(ERROR) << "StubView: Insert: " << childTag << " into "
<< parentTag << " at " << mutation.index << "("
LOG(ERROR) << "StubView: Insert [" << childTag << "] into ["
<< parentTag << "] @" << mutation.index << "("
<< parentStubView->children.size() << " children)";
});
react_native_assert(parentStubView->children.size() >= mutation.index);
@@ -100,8 +101,8 @@ void StubViewTree::mutate(ShadowViewMutationList const &mutations) {
auto parentStubView = registry[parentTag];
auto childTag = mutation.oldChildShadowView.tag;
STUB_VIEW_LOG({
LOG(ERROR) << "StubView: Remove: " << childTag << " from "
<< parentTag << " at index " << mutation.index << " with "
LOG(ERROR) << "StubView: Remove [" << childTag << "] from ["
<< parentTag << "] @" << mutation.index << " with "
<< parentStubView->children.size() << " children";
});
react_native_assert(parentStubView->children.size() > mutation.index);
@@ -133,7 +134,8 @@ void StubViewTree::mutate(ShadowViewMutationList const &mutations) {
case ShadowViewMutation::Update: {
STUB_VIEW_LOG({
LOG(ERROR) << "StubView: Update: " << mutation.newChildShadowView.tag;
LOG(ERROR) << "StubView: Update [" << mutation.newChildShadowView.tag
<< "]";
});
react_native_assert(mutation.oldChildShadowView.tag != 0);
react_native_assert(mutation.newChildShadowView.tag != 0);