Added groupCollapsed polyfill (#21457)

Summary:
`groupCollapsed` is used to group logs but collapsed which is very useful when the console has many logs (e.g. when using `redux-logger`).

For developers who prefer to debug iOS apps using Safari JSC, the `groupCollapsed` was not polyfilled.

Fixes #21446
Pull Request resolved: https://github.com/facebook/react-native/pull/21457

Differential Revision: D13761796

Pulled By: cpojer

fbshipit-source-id: e7c4f1ff4728c6a7f6ffd6cc629f7fbc1aa67e87
This commit is contained in:
Mido 2019-01-22 07:02:16 -08:00 committed by Facebook Github Bot
parent 47e77682d4
commit 638d672abc
1 changed files with 6 additions and 0 deletions

View File

@ -509,6 +509,11 @@ function consoleGroupPolyfill(label) {
groupStack.push(GROUP_PAD); groupStack.push(GROUP_PAD);
} }
function consoleGroupCollapsedPolyfill(label) {
global.nativeLoggingHook(groupFormat(GROUP_CLOSE, label), LOG_LEVELS.info);
groupStack.push(GROUP_PAD);
}
function consoleGroupEndPolyfill() { function consoleGroupEndPolyfill() {
groupStack.pop(); groupStack.pop();
global.nativeLoggingHook(groupFormat(GROUP_CLOSE), LOG_LEVELS.info); global.nativeLoggingHook(groupFormat(GROUP_CLOSE), LOG_LEVELS.info);
@ -534,6 +539,7 @@ if (global.nativeLoggingHook) {
table: consoleTablePolyfill, table: consoleTablePolyfill,
group: consoleGroupPolyfill, group: consoleGroupPolyfill,
groupEnd: consoleGroupEndPolyfill, groupEnd: consoleGroupEndPolyfill,
groupCollapsed: consoleGroupCollapsedPolyfill,
}; };
// If available, also call the original `console` method since that is // If available, also call the original `console` method since that is