()
| 58 | } |
| 59 | |
| 60 | export function reenableLogs(): void { |
| 61 | if (__DEV__) { |
| 62 | disabledDepth--; |
| 63 | if (disabledDepth === 0) { |
| 64 | const props = { |
| 65 | configurable: true, |
| 66 | enumerable: true, |
| 67 | writable: true, |
| 68 | }; |
| 69 | // $FlowFixMe[cannot-write] Flow thinks console is immutable. |
| 70 | Object.defineProperties(console, { |
| 71 | log: {...props, value: prevLog}, |
| 72 | info: {...props, value: prevInfo}, |
| 73 | warn: {...props, value: prevWarn}, |
| 74 | error: {...props, value: prevError}, |
| 75 | group: {...props, value: prevGroup}, |
| 76 | groupCollapsed: {...props, value: prevGroupCollapsed}, |
| 77 | groupEnd: {...props, value: prevGroupEnd}, |
| 78 | }); |
| 79 | } |
| 80 | if (disabledDepth < 0) { |
| 81 | console.error( |
| 82 | 'disabledDepth fell below zero. ' + |
| 83 | 'This is a bug in React. Please file an issue.', |
| 84 | ); |
| 85 | } |
| 86 | } |
| 87 | } |
no test coverage detected