Home / Function/ reenableLogs() — react Function Reference

reenableLogs() — react Function Reference

Architecture documentation for the reenableLogs() function in ConsolePatchingDev.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  b3c71ea9_d8ee_ca98_73a9_e6ba4583be6b["reenableLogs()"]
  12e674e2_5612_a3e0_5427_15a1ac66df53["ConsolePatchingDev.js"]
  b3c71ea9_d8ee_ca98_73a9_e6ba4583be6b -->|defined in| 12e674e2_5612_a3e0_5427_15a1ac66df53
  style b3c71ea9_d8ee_ca98_73a9_e6ba4583be6b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/shared/ConsolePatchingDev.js lines 60–87

export function reenableLogs(): void {
  if (__DEV__) {
    disabledDepth--;
    if (disabledDepth === 0) {
      const props = {
        configurable: true,
        enumerable: true,
        writable: true,
      };
      // $FlowFixMe[cannot-write] Flow thinks console is immutable.
      Object.defineProperties(console, {
        log: {...props, value: prevLog},
        info: {...props, value: prevInfo},
        warn: {...props, value: prevWarn},
        error: {...props, value: prevError},
        group: {...props, value: prevGroup},
        groupCollapsed: {...props, value: prevGroupCollapsed},
        groupEnd: {...props, value: prevGroupEnd},
      });
    }
    if (disabledDepth < 0) {
      console.error(
        'disabledDepth fell below zero. ' +
          'This is a bug in React. Please file an issue.',
      );
    }
  }
}

Domain

Subdomains

Frequently Asked Questions

What does reenableLogs() do?
reenableLogs() is a function in the react codebase, defined in packages/shared/ConsolePatchingDev.js.
Where is reenableLogs() defined?
reenableLogs() is defined in packages/shared/ConsolePatchingDev.js at line 60.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free