Skip to content

Commit b7ab922

Browse files
yungstersfacebook-github-bot
authored andcommitted
RN: Console Stub Parity
Summary: Brings parity to the non-`__DEV__` stub polyfill for `console`. Changelog: [General][Added] - Added missing `console` polyfills in release builds. Reviewed By: ejanzer, RSNara Differential Revision: D18667335 fbshipit-source-id: 0307d04a136e5f7bb914f18b80441b7a7fae5e5b
1 parent ac3c167 commit b7ab922

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

Libraries/polyfills/console.js

+19-4
Original file line numberDiff line numberDiff line change
@@ -615,15 +615,30 @@ if (global.nativeLoggingHook) {
615615
});
616616
}
617617
} else if (!global.console) {
618-
const log = global.print || function consoleLoggingStub() {};
618+
function stub() {}
619+
const log = global.print || stub;
620+
619621
global.console = {
622+
debug: log,
620623
error: log,
621624
info: log,
622625
log: log,
623-
warn: log,
624626
trace: log,
625-
debug: log,
626-
table: log,
627+
warn: log,
628+
assert(expression, label) {
629+
if (!expression) {
630+
log('Assertion failed: ' + label);
631+
}
632+
},
633+
clear: stub,
634+
dir: stub,
635+
dirxml: stub,
636+
group: stub,
637+
groupCollapsed: stub,
638+
groupEnd: stub,
639+
profile: stub,
640+
profileEnd: stub,
641+
table: stub,
627642
};
628643

629644
Object.defineProperty(console, '_isPolyfilled', {

0 commit comments

Comments
 (0)