From 84d0a2ed4e80f7c2909976990e8b2dc6b50e44a1 Mon Sep 17 00:00:00 2001 From: Joshua Gross Date: Tue, 9 Feb 2021 22:40:17 -0800 Subject: [PATCH] Flush glog lines at the end of StubViewTree mutate function Summary: On iOS, log lines are not entirely flushed when an assert is hit right after (or during) this mutate function. Make sure to flush log lines regularly during this function so that debugging is easier. Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D26291789 fbshipit-source-id: 47af109cdc3dcfc6bf08cbb41db06e9260bfaa08 --- ReactCommon/react/renderer/mounting/StubViewTree.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ReactCommon/react/renderer/mounting/StubViewTree.cpp b/ReactCommon/react/renderer/mounting/StubViewTree.cpp index 481974997d1..bc51d102603 100644 --- a/ReactCommon/react/renderer/mounting/StubViewTree.cpp +++ b/ReactCommon/react/renderer/mounting/StubViewTree.cpp @@ -12,9 +12,12 @@ // Uncomment to enable verbose StubViewTree debug logs // #define STUB_VIEW_TREE_VERBOSE 1 +// For iOS especially: flush logs because some might be lost on iOS if an +// assert is hit right after this. #define STUB_VIEW_ASSERT(cond) \ if (!(cond)) { \ LOG(ERROR) << "ASSERT FAILURE: " << #cond; \ + google::FlushLogFiles(google::INFO); \ } \ assert(cond); @@ -156,6 +159,10 @@ void StubViewTree::mutate(ShadowViewMutationList const &mutations) { } } STUB_VIEW_LOG({ LOG(ERROR) << "StubView: Mutating End"; }); + + // For iOS especially: flush logs because some might be lost on iOS if an + // assert is hit right after this. + google::FlushLogFiles(google::INFO); } bool operator==(StubViewTree const &lhs, StubViewTree const &rhs) {