From e9ff6d8bcacdc5d2727901f637614007e86f86cc Mon Sep 17 00:00:00 2001 From: Joshua Gross Date: Wed, 31 Mar 2021 21:29:13 -0700 Subject: [PATCH] Print ShadowView hash when displaying instructions Summary: When displaying instructions in debug logs, also print ShadowView hash to make it easier to reconstruct a series of events. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D27492938 fbshipit-source-id: 276a080a4afcfb4aa0aafc215e2ccd56ef849fcf --- .../animations/LayoutAnimationKeyFrameManager.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp b/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp index 1300702bf0b..e30e9899f4c 100644 --- a/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp +++ b/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp @@ -60,8 +60,19 @@ static std::string GetMutationInstructionString( void PrintMutationInstruction( std::string message, ShadowViewMutation const &mutation) { - LOG(ERROR) << message - << " Mutation: " << GetMutationInstructionString(mutation); + [&](std::ostream &stream) -> std::ostream & { + stream << message + << " Mutation: " << GetMutationInstructionString(mutation); + if (mutation.oldChildShadowView.tag != 0) { + stream << " old hash: ##" + << std::hash{}(mutation.oldChildShadowView); + } + if (mutation.newChildShadowView.tag != 0) { + stream << " new hash: ##" + << std::hash{}(mutation.newChildShadowView); + } + return stream; + }(LOG(ERROR)); } void PrintMutationInstructionRelative( std::string message,