File tree 1 file changed +8
-6
lines changed
1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -516,6 +516,14 @@ function consoleGroupEndPolyfill() {
516
516
517
517
if ( global . nativeLoggingHook ) {
518
518
const originalConsole = global . console ;
519
+ // Preserve the original `console` as `originalConsole`
520
+ if ( __DEV__ && originalConsole ) {
521
+ const descriptor = Object . getOwnPropertyDescriptor ( global , 'console' ) ;
522
+ if ( descriptor ) {
523
+ Object . defineProperty ( global , 'originalConsole' , descriptor ) ;
524
+ }
525
+ }
526
+
519
527
global . console = {
520
528
error : getNativeLogFunction ( LOG_LEVELS . error ) ,
521
529
info : getNativeLogFunction ( LOG_LEVELS . info ) ,
@@ -532,12 +540,6 @@ if (global.nativeLoggingHook) {
532
540
// sometimes useful. Ex: on OS X, this will let you see rich output in
533
541
// the Safari Web Inspector console.
534
542
if ( __DEV__ && originalConsole ) {
535
- // Preserve the original `console` as `originalConsole`
536
- const descriptor = Object . getOwnPropertyDescriptor ( global , 'console' ) ;
537
- if ( descriptor ) {
538
- Object . defineProperty ( global , 'originalConsole' , descriptor ) ;
539
- }
540
-
541
543
Object . keys ( console ) . forEach ( methodName => {
542
544
const reactNativeMethod = console [ methodName ] ;
543
545
if ( originalConsole [ methodName ] ) {
You can’t perform that action at this time.
0 commit comments