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
This commit is contained in:
Joshua Gross
2021-02-09 22:43:43 -08:00
committed by Facebook GitHub Bot
parent e0f1101e7e
commit 84d0a2ed4e
@@ -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) {