From b88ec8b144b7352364bdedded46d4933bd9f289b Mon Sep 17 00:00:00 2001 From: Joshua Gross Date: Fri, 12 Mar 2021 09:27:28 -0800 Subject: [PATCH] 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 --- .../react/renderer/mounting/StubViewTree.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/ReactCommon/react/renderer/mounting/StubViewTree.cpp b/ReactCommon/react/renderer/mounting/StubViewTree.cpp index 33cefbacd8f..cdcae7e1c28 100644 --- a/ReactCommon/react/renderer/mounting/StubViewTree.cpp +++ b/ReactCommon/react/renderer/mounting/StubViewTree.cpp @@ -49,15 +49,16 @@ void StubViewTree::mutate(ShadowViewMutationList const &mutations) { auto stubView = std::make_shared(); 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);