console polyfill: pass unsupported messages to original console
Summary: Some console methods (like `groupCollapsed` or `clear`) are not supported by console.js polyfill and are not passed to the original console objects. Reviewed By: sahrens Differential Revision: D12900996 fbshipit-source-id: 1b2f487028e418ae934f631996eaaf63abdced82
This commit is contained in:
parent
2a8f6c3028
commit
bccc4548e4
|
@ -558,6 +558,25 @@ if (global.nativeLoggingHook) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// The following methods are not supported by this polyfill but
|
||||||
|
// we still should pass them to original console if they are
|
||||||
|
// supported by it.
|
||||||
|
[
|
||||||
|
'assert',
|
||||||
|
'clear',
|
||||||
|
'dir',
|
||||||
|
'dirxml',
|
||||||
|
'groupCollapsed',
|
||||||
|
'profile',
|
||||||
|
'profileEnd',
|
||||||
|
].forEach(methodName => {
|
||||||
|
if (typeof originalConsole[methodName] === 'function') {
|
||||||
|
console[methodName] = function() {
|
||||||
|
originalConsole[methodName](...arguments);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else if (!global.console) {
|
} else if (!global.console) {
|
||||||
const log = global.print || function consoleLoggingStub() {};
|
const log = global.print || function consoleLoggingStub() {};
|
||||||
|
|
Loading…
Reference in New Issue